bool MainWindow::confirmToGo() { if(!isWindowModified()) return true; //show dialogue int ret = QMessageBox::warning(this, tr("Save Changes?"), tr("The document has been modified.\n" "Do you want to save the changes?"), QMessageBox::Save, QMessageBox::Discard, QMessageBox::Cancel); switch (ret) { case QMessageBox::Save: if(getCurrentFileName().isEmpty()) on_actionSaveAs_triggered(); else on_actionSave_triggered(); case QMessageBox::Discard: return true; default: // QMessageBox::Cancel break; } return false; }
StatsTreeDialog::StatsTreeDialog(QWidget *parent, capture_file *cf, const char *cfg_abbr) : QDialog(parent), ui(new Ui::StatsTreeDialog), st_(NULL), st_cfg_(NULL), cap_file_(cf) { ui->setupUi(this); st_cfg_ = stats_tree_get_cfg_by_abbr(cfg_abbr); if (!st_cfg_) { QMessageBox::critical(this, tr("Configuration not found"), tr("Unable to find configuration for %1.").arg(cfg_abbr)); QMetaObject::invokeMethod(this, "reject", Qt::QueuedConnection); } ui->statsTreeWidget->addAction(ui->actionCopyToClipboard); ui->statsTreeWidget->addAction(ui->actionSaveAs); ui->statsTreeWidget->setContextMenuPolicy(Qt::ActionsContextMenu); QPushButton *button; button = ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); connect(button, SIGNAL(clicked()), this, SLOT(on_actionCopyToClipboard_triggered())); button = ui->buttonBox->addButton(tr("Save as..."), QDialogButtonBox::ActionRole); connect(button, SIGNAL(clicked()), this, SLOT(on_actionSaveAs_triggered())); fillTree(); }
int TvrUiWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: on_actionVolume_triggered(); break; case 1: on_actionNew_triggered(); break; case 2: on_actionSave_triggered(); break; case 3: on_actionSaveAs_triggered(); break; case 4: on_actionAbout_triggered(); break; case 5: on_actionOpen_triggered(); break; case 6: on_actionExit_triggered(); break; case 7: on_actionRecord_triggered(); break; case 8: on_actionStop_triggered(); break; case 9: on_actionPlay_triggered(); break; case 10: on_actionPaused_triggered(); break; case 11: updateProgressBar(); break; default: ; } _id -= 12; } return _id; }
bool QuaMainWindow::IBFSetupMenuFile() { QAction * actionNew = new QAction(tr("&New"), this); actionNew->setShortcut(QKeySequence::New); connect(actionNew, SIGNAL(triggered()), this, SLOT(on_actionNew_triggered())); addAction(actionNew); QAction * actionOpen = new QAction(tr("&Open..."), this); actionOpen->setShortcut(QKeySequence::Open); connect(actionOpen, SIGNAL(triggered()), this, SLOT(on_actionOpen_triggered())); addAction(actionOpen); QAction * actionSave = new QAction(tr("&Save"), this); actionSave->setShortcut(QKeySequence::Save); connect(actionSave, SIGNAL(triggered()), this, SLOT(on_actionSave_triggered())); addAction(actionSave); QAction * actionSaveAs = new QAction(tr("Save &As..."), this); actionSaveAs->setShortcut(QKeySequence::SaveAs); connect(actionSaveAs, SIGNAL(triggered()), this, SLOT(on_actionSaveAs_triggered())); addAction(actionSaveAs); QAction * actionQuit = new QAction(tr("&Quit"), this); actionQuit->setShortcut(Qt::CTRL + Qt::Key_Q); connect(actionQuit, SIGNAL(triggered()), this, SLOT(close())); addAction(actionQuit); // QAction * actionPreview = new QAction(tr("Preview"), this); // actionPreview->setShortcut(QKeySequence(tr("Ctrl+P"))); // connect(actionPreview, SIGNAL(triggered()), this, SLOT(on_actionPreview_triggered())); // //tViewMenu->addAction(actionPreview); // addAction(actionPreview); return true; }
void MainWindow::on_actionSave_triggered() { if(!filer->isFileOpen()) { return on_actionSaveAs_triggered(); } if(filer->save(ui->mdEdit->toPlainText())) { changedSinceSave = false; } }
bool MainWindow::on_actionSave_triggered(void) { if (m_curProgram.isEmpty()) { return on_actionSaveAs_triggered(); } else { return programSave(m_curProgram); } }
bool QuaMainWindow::IBFSetupConnections() { connect(mQuaTextEdit, SIGNAL(signal_actionNew()), this, SLOT(on_actionNew_triggered())); connect(mQuaTextEdit, SIGNAL(signal_actionOpen()), this, SLOT(on_actionOpen_triggered())); connect(mQuaTextEdit, SIGNAL(signal_actionSave()), this, SLOT(on_actionSave_triggered())); connect(mQuaTextEdit, SIGNAL(signal_actionSaveAs()), this, SLOT(on_actionSaveAs_triggered())); connect(mQuaTextEdit, SIGNAL(signal_actionQuit()), this, SLOT(on_actionQuit_triggered())); connect(mQuaTextEdit, SIGNAL(textChanged()), this, SLOT(on_SignalModified())); connect(mIBFTreeView, SIGNAL(SignalModified()), this, SLOT(on_SignalModified())); return true; }
void FPMEditorMainWindows::on_actionSave_triggered() { if (modelsTabs->currentIndex() != -1) { FPModelUI * modelUI = (FPModelUI *)modelsTabs->currentWidget(); if (modelUI->getModel()->path == "") { on_actionSaveAs_triggered(); } else { ops::fp::FPMWriter * fpmHandler = new ops::fp::FPMWriter(); fpmHandler->save(modelUI->getModel()->path, modelUI->getModel()); delete fpmHandler; modelUI->setSaved(true); } } }
void MainWindow::on_actionSave_triggered() { if(!isWindowModified()){ ui->statusBar->showMessage("Nothing to save", 2000); return; } QString fileName = getCurrentFileName(); if(fileName.isEmpty()){ on_actionSaveAs_triggered(); } else{ saveFile(fileName); } }
TapParameterDialog::TapParameterDialog(QWidget &parent, CaptureFile &cf, int help_topic) : WiresharkDialog(parent, cf), ui(new Ui::TapParameterDialog), help_topic_(help_topic) { ui->setupUi(this); // XXX Use recent settings instead resize(parent.width() * 2 / 3, parent.height() * 3 / 4); // Only show a hint label if a subclass provides a hint. ui->hintLabel->hide(); ctx_menu_.addAction(ui->actionCopyToClipboard); ctx_menu_.addAction(ui->actionSaveAs); QPushButton *button; button = ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); connect(button, SIGNAL(clicked()), this, SLOT(on_actionCopyToClipboard_triggered())); button = ui->buttonBox->addButton(tr("Save as" UTF8_HORIZONTAL_ELLIPSIS), QDialogButtonBox::ActionRole); connect(button, SIGNAL(clicked()), this, SLOT(on_actionSaveAs_triggered())); connect(ui->displayFilterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(updateWidgets())); ProgressFrame::addToButtonBox(ui->buttonBox, &parent); if (help_topic_ < 1) { ui->buttonBox->button(QDialogButtonBox::Help)->hide(); } if (!ui->displayFilterLineEdit->text().isEmpty()) { QString filter = ui->displayFilterLineEdit->text(); emit updateFilter(filter, true); } show_timer_ = new QTimer(this); setRetapOnShow(true); }
Elmo::Elmo(QWidget *parent) : QMainWindow(parent), ui(new Ui::Elmo), shortcuts(new QList<QShortcut*>), projects(new QList<Project*>), lastSaveFilename("") { ui->setupUi(this); QShortcut * shortcut = new QShortcut(QKeySequence(tr("Ctrl+L", "File|actionOpen")), this); shortcut->setContext(Qt::ApplicationShortcut); connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionOpen_triggered())); shortcuts->push_back(shortcut); shortcut = new QShortcut(QKeySequence(tr("Ctrl+S", "File|actionSave")), this); shortcut->setContext(Qt::ApplicationShortcut); connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionSave_triggered())); shortcuts->push_back(shortcut); shortcut = new QShortcut(QKeySequence(tr("Ctrl+N", "File|actionNew")), this); shortcut->setContext(Qt::ApplicationShortcut); connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionNew_triggered())); shortcuts->push_back(shortcut); shortcut = new QShortcut(QKeySequence(tr("Ctrl+Shift+S", "File|actionSave_as")), this); shortcut->setContext(Qt::ApplicationShortcut); connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionSaveAs_triggered())); shortcuts->push_back(shortcut); shortcut = new QShortcut(QKeySequence(tr("Ctrl+O", "File|actionAdd")), this); shortcut->setContext(Qt::ApplicationShortcut); connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionAdd_triggered())); shortcuts->push_back(shortcut); QImage image("/home/cerkiewny/test.png"); QGraphicsView* view = findChild<QGraphicsView*>("mainView"); QGraphicsScene* scene = new QGraphicsScene(); QGraphicsPixmapItem * item = new QGraphicsPixmapItem( QPixmap::fromImage(image)); scene->addItem(item); view->setScene(scene); view->show(); }
void MainWindow::on_actionSave_triggered() { on_actionSaveAs_triggered(); }
bool MainWindow::on_actionSave_triggered() { if (untitled_) return on_actionSaveAs_triggered(); else return SaveXMLDocument(file_name_); }