void MainWindow::closeBookmarksFile() { if ( _bookmarkList->getUpdated() ) { QMessageBox msgBox; msgBox.setText("File have unsaved changes"); msgBox.setInformativeText("Save changes?"); msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Save); int option = msgBox.exec(); switch (option) { case QMessageBox::Save: saveBookmarksFile(); clearBookmarkList(); break; case QMessageBox::Discard: clearBookmarkList(); break; case QMessageBox::Cancel: break; } } else { clearBookmarkList(); } }
void PropertiesDialog::apply() { Properties::Instance()->colorScheme = colorSchemaCombo->currentText(); Properties::Instance()->font = fontSampleLabel->font();//fontComboBox->currentFont(); Properties::Instance()->guiStyle = (styleComboBox->currentText() == tr("System Default")) ? QString() : styleComboBox->currentText(); Properties::Instance()->emulation = emulationComboBox->currentText(); /* do not allow to go above 99 or we lose transparency option */ (appTransparencyBox->value() >= 100) ? Properties::Instance()->appTransparency = 99 : Properties::Instance()->appTransparency = appTransparencyBox->value(); Properties::Instance()->termTransparency = termTransparencyBox->value(); Properties::Instance()->highlightCurrentTerminal = highlightCurrentCheckBox->isChecked(); Properties::Instance()->backgroundImage = backgroundImageLineEdit->text(); Properties::Instance()->askOnExit = askOnExitCheckBox->isChecked(); Properties::Instance()->savePosOnExit = savePosOnExitCheckBox->isChecked(); Properties::Instance()->saveSizeOnExit = saveSizeOnExitCheckBox->isChecked(); Properties::Instance()->useCWD = useCwdCheckBox->isChecked(); Properties::Instance()->scrollBarPos = scrollBarPos_comboBox->currentIndex(); Properties::Instance()->tabsPos = tabsPos_comboBox->currentIndex(); Properties::Instance()->keyboardCursorShape = keybCursorShape_comboBox->currentIndex(); Properties::Instance()->hideTabBarWithOneTab = hideTabBarCheckBox->isChecked(); Properties::Instance()->menuVisible = showMenuCheckBox->isChecked(); Properties::Instance()->m_motionAfterPaste = motionAfterPasting_comboBox->currentIndex(); Properties::Instance()->historyLimited = historyLimited->isChecked(); Properties::Instance()->historyLimitedTo = historyLimitedTo->value(); saveShortcuts(); Properties::Instance()->saveSettings(); Properties::Instance()->dropShowOnStart = dropShowOnStartCheckBox->isChecked(); Properties::Instance()->dropHeight = dropHeightSpinBox->value(); Properties::Instance()->dropWidht = dropWidthSpinBox->value(); Properties::Instance()->dropShortCut = QKeySequence(dropShortCutEdit->text()); Properties::Instance()->useBookmarks = useBookmarksCheckBox->isChecked(); Properties::Instance()->bookmarksFile = bookmarksLineEdit->text(); saveBookmarksFile(Properties::Instance()->bookmarksFile); Properties::Instance()->terminalsPreset = terminalPresetComboBox->currentIndex(); Properties::Instance()->changeWindowTitle = changeWindowTitleCheckBox->isChecked(); Properties::Instance()->changeWindowIcon = changeWindowIconCheckBox->isChecked(); Properties::Instance()->trimPastedTrailingNewlines = trimPastedTrailingNewlinesCheckBox->isChecked(); Properties::Instance()->confirmMultilinePaste = confirmMultilinePasteCheckBox->isChecked(); emit propertiesChanged(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); // Menu QMenu* modelMenu = menuBar()->addMenu("&Model"); modelMenu->addAction("&Open model...", this, SLOT(openModel()) ); modelMenu->addSeparator(); modelMenu->addAction("&Close model", this, SLOT(closeModel()) ); QMenu* markMenu = menuBar()->addMenu("&Bookmarks"); markMenu->addAction("&New file...", this, SLOT(closeBookmarksFile()) ); markMenu->addAction("&Open file...", this, SLOT(openBookmarksFile()) ); markMenu->addSeparator(); markMenu->addAction("&Close file", this, SLOT(closeBookmarksFile()) ); markMenu->addSeparator(); markMenu->addAction("&Save file", this, SLOT(saveBookmarksFile())); markMenu->addAction("&Save file as...", this, SLOT(saveAsBookmarksFile())); QMenu* viewMenu = menuBar()->addMenu("&View"); viewMenu->addAction("&View as points", this, SLOT(viewAsPoints()) ); viewMenu->addAction("&View as wired", this, SLOT(viewAsWired()) ); viewMenu->addAction("&View as solid", this, SLOT(viewAsSolid()) ); viewMenu->addAction("&View as solid + wired",this, SLOT(viewAsSolidWire()) ); QMenu* modeMenu = menuBar()->addMenu("&Mode"); modeMenu->addAction("&Viewer", this, SLOT(viewerMode()) ); modeMenu->addAction("&Editor", this, SLOT(editorMode()) ); modeMenu->addAction("&Ask Me!", this, SLOT(testMode()) ); // Section list panel buttons. QObject::connect(ui->addButton, SIGNAL(clicked()), this, SLOT(showAddSectionPanel())); QObject::connect(ui->editButton, SIGNAL(clicked()), this, SLOT(showEditSectionPanel())); QObject::connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteCurrentSection())); QObject::connect(ui->infoButton, SIGNAL(clicked()), this, SLOT(showInfoSectionPanel())); QObject::connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(listWidgetItemClicked(QListWidgetItem*))); // Add bookmark panel buttons. QObject::connect(ui->addModeButton, SIGNAL(clicked()), this, SLOT(setAddSelectionMode())); QObject::connect(ui->removeModeButton, SIGNAL(clicked()), this, SLOT(setRemoveSelectionMode())); QObject::connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(saveBookmark())); QObject::connect(ui->discardButton, SIGNAL(clicked()), this, SLOT(discardBookmark())); QObject::connect(ui->brushSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(setBrushSize(int))); // Information panel buttons QObject::connect(ui->backButton, SIGNAL(clicked()), this, SLOT(showListPanel())); // Test panel buttons QObject::connect(ui->nextQuestionButton, SIGNAL(clicked()), this, SLOT(nextQuestion())); QObject::connect(ui->glwidget, SIGNAL(pickResult(std::set<unsigned int>)), this, SLOT(checkResponse(std::set<unsigned int>))); // Set window title. setWindowTitle("untitled.txt"); // Initialize variables. _bookmarkList = new BookmarkList(); clearBookmarkList(); _model = new Model(); _indexTest = 0; // Set viewer mode. viewerMode(); // Show welcome message statusBar()->showMessage("Welcome to 3D Marker."); }