mirror of https://github.com/CGAL/cgal
Merge pull request #2022 from maxGimeno/Polyhedron_demo-Reset_load_preferences-GF
Polyhedron_demo : Reverse alwaysUse
This commit is contained in:
commit
3848a3cef4
|
|
@ -351,35 +351,12 @@ MainWindow::MainWindow(QWidget* parent)
|
|||
}
|
||||
|
||||
QMenu* menuFile = findChild<QMenu*>("menuFile");
|
||||
if ( NULL != menuFile )
|
||||
{
|
||||
QList<QAction*> menuFileActions = menuFile->actions();
|
||||
|
||||
// Look for action just after "Load..." action
|
||||
QAction* actionAfterLoad = NULL;
|
||||
for ( QList<QAction*>::iterator it_action = menuFileActions.begin(),
|
||||
end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions)
|
||||
{
|
||||
if ( NULL != *it_action && (*it_action)->text().contains("Load") )
|
||||
{
|
||||
++it_action;
|
||||
if ( it_action != end && NULL != *it_action )
|
||||
{
|
||||
actionAfterLoad = *it_action;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Insert "Load implicit function" action
|
||||
if ( NULL != actionAfterLoad )
|
||||
{
|
||||
menuFile->insertAction(actionAfterLoad,actionAddToGroup);
|
||||
}
|
||||
}
|
||||
|
||||
insertActionBeforeLoadPlugin(menuFile, actionAddToGroup);
|
||||
statistics_dlg = NULL;
|
||||
statistics_ui = new Ui::Statistics_on_item_dialog();
|
||||
|
||||
actionResetDefaultLoaders = new QAction("Reset Default Loaders",this);
|
||||
|
||||
#ifdef QT_SCRIPT_LIB
|
||||
// evaluate_script("print(plugins);");
|
||||
Q_FOREACH(QAction* action, findChildren<QAction*>()) {
|
||||
|
|
@ -655,6 +632,7 @@ void MainWindow::updateMenus()
|
|||
ui->menuOperations->clear();
|
||||
ui->menuOperations->addActions(as);
|
||||
}
|
||||
|
||||
bool MainWindow::hasPlugin(const QString& pluginName) const
|
||||
{
|
||||
Q_FOREACH(const PluginNamePair& p, plugins) {
|
||||
|
|
@ -1028,7 +1006,12 @@ void MainWindow::open(QString filename)
|
|||
if(!ok || load_pair.first.isEmpty()) { return; }
|
||||
|
||||
if (load_pair.second)
|
||||
default_plugin_selection[fileinfo.completeSuffix()]=load_pair.first;
|
||||
{
|
||||
connect(actionResetDefaultLoaders, SIGNAL(triggered()),
|
||||
this, SLOT(reset_default_loaders()));
|
||||
default_plugin_selection[fileinfo.completeSuffix()]=load_pair.first;
|
||||
insertActionBeforeLoadPlugin(ui->menuFile, actionResetDefaultLoaders);
|
||||
}
|
||||
|
||||
|
||||
QSettings settings;
|
||||
|
|
@ -1945,3 +1928,28 @@ void MainWindow::resetHeader()
|
|||
}
|
||||
|
||||
|
||||
void MainWindow::reset_default_loaders()
|
||||
{
|
||||
default_plugin_selection.clear();
|
||||
|
||||
const char* prop_name = "Menu modified by MainWindow.";
|
||||
QMenu* menu = ui->menuFile;
|
||||
if(!menu)
|
||||
return;
|
||||
bool menuChanged = menu->property(prop_name).toBool();
|
||||
if(!menuChanged) {
|
||||
menu->setProperty(prop_name, true);
|
||||
}
|
||||
QList<QAction*> menuActions = menu->actions();
|
||||
menu->removeAction(actionResetDefaultLoaders);
|
||||
}
|
||||
|
||||
void MainWindow::insertActionBeforeLoadPlugin(QMenu* menu, QAction* actionToInsert)
|
||||
{
|
||||
if(menu)
|
||||
{
|
||||
QList<QAction*> menuActions = menu->actions();
|
||||
if(!menuActions.contains(actionToInsert))
|
||||
menu->insertAction(ui->actionLoadPlugin, actionToInsert);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ public Q_SLOTS:
|
|||
void setExpanded(QModelIndex);
|
||||
void setCollapsed(QModelIndex);
|
||||
bool file_matches_filter(const QString& filters, const QString& filename);
|
||||
void reset_default_loaders();
|
||||
//!Prints a dialog containing statistics on the selected polyhedrons.
|
||||
void statisticsOnItem();
|
||||
/*! Open a file with a given loader, and return true if it was successful.
|
||||
|
|
@ -372,11 +373,13 @@ private:
|
|||
QVector<PluginNamePair > plugins;
|
||||
//!Called when "Add new group" in the file menu is triggered.
|
||||
QAction* actionAddToGroup;
|
||||
QAction* actionResetDefaultLoaders;
|
||||
void print_message(QString message) { messages->information(message); }
|
||||
Messages_interface* messages;
|
||||
|
||||
QDialog *statistics_dlg;
|
||||
Ui::Statistics_on_item_dialog* statistics_ui;
|
||||
void insertActionBeforeLoadPlugin(QMenu*, QAction *actionToInsert);
|
||||
|
||||
#ifdef QT_SCRIPT_LIB
|
||||
QScriptEngine* script_engine;
|
||||
|
|
|
|||
Loading…
Reference in New Issue