src/main.cpp

changeset 262
dc33f8a707c4
parent 259
c27612f0eac0
child 263
59b6027b9843
equal deleted inserted replaced
261:6a875faebde2 262:dc33f8a707c4
16 #include "widgets/colorselectdialog.h" 16 #include "widgets/colorselectdialog.h"
17 #include "settings.h" 17 #include "settings.h"
18 #include "ui/circletooloptionswidget.h" 18 #include "ui/circletooloptionswidget.h"
19 #include "messagelog.h" 19 #include "messagelog.h"
20 #include "ui/objecteditor.h" 20 #include "ui/objecteditor.h"
21 #include "ldrawalgorithm.h"
21 22
22 static const QDir LOCALE_DIR {":/locale"}; 23 static const QDir LOCALE_DIR {":/locale"};
23 24
24 class ModelSubWindow : public QMdiSubWindow 25 class ModelSubWindow : public QMdiSubWindow
25 { 26 {
414 std::visit(overloaded{ 415 std::visit(overloaded{
415 [model](const AppendToModel& action){ 416 [model](const AppendToModel& action){
416 model->append(action.newElement); 417 model->append(action.newElement);
417 }, 418 },
418 [model](const DeleteFromModel& action){ 419 [model](const DeleteFromModel& action){
419 model->remove(action.position); 420 model->remove(action.position);
421 },
422 [model](const ModifyModel& action){
423 model->assignAt(action.position, action.newElement);
420 }, 424 },
421 }, action); 425 }, action);
422 }; 426 };
423 const auto restoreSettings = [&]{ 427 const auto restoreSettings = [&]{
424 recentlyOpenedFiles = setting<Setting::RecentFiles>(); 428 recentlyOpenedFiles = setting<Setting::RecentFiles>();
692 [&ui, &documents](const CircleToolOptions& options) { 696 [&ui, &documents](const CircleToolOptions& options) {
693 if (ModelData* data = currentModelData(&ui, &documents)) { 697 if (ModelData* data = currentModelData(&ui, &documents)) {
694 data->tools->setCircleToolOptions(options); 698 data->tools->setCircleToolOptions(options);
695 } 699 }
696 }); 700 });
701 QObject::connect(
702 ui.actionMakeUnofficial,
703 &QAction::triggered,
704 [&]{
705 if (ModelData* data = currentModelData(&ui, &documents)) {
706 Model* const model = data->model;
707 for (const ModelAction& action : ldraw::makeUnofficial(model)) {
708 executeAction(model, action);
709 }
710 }
711 });
697 mainWindow.setWindowTitle(title()); 712 mainWindow.setWindowTitle(title());
698 mainWindow.tabifyDockWidget(ui.messageLogDock, ui.toolOptionsDock); 713 mainWindow.tabifyDockWidget(ui.messageLogDock, ui.toolOptionsDock);
699 mainWindow.restoreGeometry(setting<Setting::MainWindowGeometry>()); 714 mainWindow.restoreGeometry(setting<Setting::MainWindowGeometry>());
700 mainWindow.restoreState(setting<Setting::MainWindowState>()); 715 mainWindow.restoreState(setting<Setting::MainWindowState>());
701 // If a dock is made floating and the app is closed, the dock becomes invisible 716 // If a dock is made floating and the app is closed, the dock becomes invisible

mercurial