void BookmarksWindow::setupConnections() { connect(addButton,SIGNAL(clicked()),this, SLOT(on_addButton_clicked())); connect(addBookmarkWindow, SIGNAL(addBookmark(Bookmark *)), this, SLOT(addBookmarkItem(Bookmark *))); connect(removeButton,SIGNAL(clicked()),this, SLOT(on_removeButton_clicked())); connect(closeButton,SIGNAL(clicked()),this,SLOT(on_closeButton_clicked())); connect(loadButton,SIGNAL(clicked()),this,SLOT(on_loadButton_clicked())); connect(saveButton,SIGNAL(clicked()),this,SLOT(on_saveButton_clicked())); connect(openButton,SIGNAL(clicked()),this,SLOT(on_openButton_clicked())); }
void MainWidget::createActions() { shotAction = new QAction(tr("Sho&t"), this); connect(shotAction, SIGNAL(triggered()), this, SLOT(on_shotButton_clicked())); saveAction = new QAction(tr("&Save"), this); connect(saveAction, SIGNAL(triggered()), this, SLOT(on_saveButton_clicked())); uploadAction = new QAction(tr("&Get &Link"), this); connect(uploadAction, SIGNAL(triggered()), this, SLOT(on_uploadButton_clicked())); quitAction = new QAction(tr("&Quit"), this); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); }
/** * Event filters on the task dialog */ bool TodoDialog::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); if (obj == ui->newItemEdit) { // set focus to the task list if Key_Down or Key_Tab // were pressed in the new item edit if ((keyEvent->key() == Qt::Key_Down) || (keyEvent->key() == Qt::Key_Tab)) { // choose an other selected item if current item is invisible QListWidgetItem *item = ui->todoList->currentItem(); if ((item != NULL) && ui->todoList->currentItem()->isHidden() && (firstVisibleTodoListRow >= 0)) { ui->todoList->setCurrentRow(firstVisibleTodoListRow); } // give the keyboard focus to the task list widget ui->todoList->setFocus(); return true; } return false; } else if (obj == ui->todoList) { // set focus to the description edit if the tab key is pressed if (keyEvent->key() == Qt::Key_Tab) { ui->descriptionEdit->setFocus(); return true; } else if ((keyEvent->key() == Qt::Key_Delete) || (keyEvent->key() == Qt::Key_Backspace)) { on_removeButton_clicked(); return true; } return false; } else if (obj == ui->reminderDateTimeEdit) { // store the task and set focus to the description edit if the // return key is pressed if (keyEvent->key() == Qt::Key_Return) { on_saveButton_clicked(); ui->descriptionEdit->setFocus(); return true; } return false; } } return QDialog::eventFilter(obj, event); }
/** * Saves the current note and inserts a link to it in the current note of the * main window */ void TodoDialog::onSaveAndInsertButtonClicked() { on_saveButton_clicked(); QString selectedText = _mainWindow->activeNoteTextEdit()->textCursor().selectedText(); QString taskUrl = "task://" + currentCalendarItem.getUid(); // insert a link to the task in the current note QString summaryText = selectedText.isEmpty() ? currentCalendarItem.getSummary() : selectedText; QString insertText = "[" + summaryText + "](" + taskUrl + ")"; _mainWindow->activeNoteTextEdit()->textCursor().insertText(insertText); close(); }
int MainWindow::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_pushButton_clicked(); break; case 1: on_saveButton_clicked(); break; case 2: on_pushButton_2_clicked(); break; case 3: timerDone(); break; default: ; } _id -= 4; } return _id; }
void TodoDialog::setupUi() { setupMainSplitter(); refreshUi(); ui->newItemEdit->installEventFilter(this); ui->todoList->installEventFilter(this); ui->reminderDateTimeEdit->installEventFilter(this); ui->newItemEdit->setFocus(); // adding shortcuts, that weren't working when defined in the ui file QShortcut *shortcut = new QShortcut(QKeySequence("Ctrl+S"), this); QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(on_saveButton_clicked())); shortcut = new QShortcut(QKeySequence("Ctrl+I"), this); QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(onSaveAndInsertButtonClicked())); shortcut = new QShortcut(QKeySequence("Ctrl+R"), this); QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(on_removeButton_clicked())); /* * setup the note button menu */ QMenu *noteMenu = new QMenu(); QAction *insertAction = noteMenu->addAction( tr("Save and insert into note")); insertAction->setIcon(QIcon::fromTheme( "document-save", QIcon(":icons/breeze-qownnotes/16x16/document-save.svg"))); insertAction->setToolTip(tr("Save the current todo item and insert a link" " to it into the current note")); connect(insertAction, SIGNAL(triggered()), this, SLOT(onSaveAndInsertButtonClicked())); QAction *importAction = noteMenu->addAction(tr("Import as note")); importAction->setIcon(QIcon::fromTheme( "document-import", QIcon(":icons/breeze-qownnotes/16x16/document-import.svg"))); importAction->setToolTip(tr("Import the current todo item as new note")); connect(importAction, SIGNAL(triggered()), this, SLOT(onImportAsNoteButtonClicked())); ui->noteButton->setMenu(noteMenu); /* * setup the reload button menu */ QMenu *reloadMenu = new QMenu(); QAction *reloadAction = reloadMenu->addAction(tr("Reload from server")); reloadAction->setIcon(QIcon::fromTheme( "view-refresh", QIcon(":icons/breeze-qownnotes/16x16/view-refresh.svg"))); reloadAction->setToolTip(tr("Reload tasks from server")); connect(reloadAction, SIGNAL(triggered()), this, SLOT(reloadTodoList())); QAction *clearCacheAction = reloadMenu->addAction( tr("Clear cache and reload")); clearCacheAction->setIcon(QIcon::fromTheme( "trash-empty", QIcon(":icons/breeze-qownnotes/16x16/trash-empty.svg"))); clearCacheAction->setToolTip(tr("Clear calendar cache and reload tasks " "from server")); connect(clearCacheAction, SIGNAL(triggered()), this, SLOT(clearCacheAndReloadTodoList())); ui->reloadTodoListButton->setMenu(reloadMenu); }
/** * Pressing return in the summary text line of a task saves it */ void TodoDialog::on_summaryEdit_returnPressed() { // save the task if the save button is enabled if (ui->saveButton->isEnabled()) { on_saveButton_clicked(); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // add account object to a users database //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void MainWindow::on_addButton_clicked() { on_saveButton_clicked(); }
//typedef char BYTE; //! [0] Decrypter::Decrypter() { keystreamfilename=""; savefilename=""; QDesktopWidget desk; qreal px_width = desk.width() / 2; //qreal px_height = desk.height() / 2; QVBoxLayout *layout = new QVBoxLayout; QHBoxLayout *versionBox = new QHBoxLayout; QButtonGroup *versiongroup = new QButtonGroup(this); xysave = new QRadioButton( "XY" ); orassave = new QRadioButton( "ORAS" ); versiongroup->addButton(xysave); versiongroup->addButton(orassave); versionBox->addWidget(xysave); versionBox->addWidget(orassave); QHBoxLayout *keyBox = new QHBoxLayout; QPushButton *keystreamButton=new QPushButton("Load Keystream"); connect(keystreamButton, SIGNAL(clicked()), this, SLOT(on_keystreamButton_clicked())); keystreamPathDisplay=new QLineEdit; keystreamPathDisplay->setReadOnly(true); keystreamPathDisplay->setMinimumWidth(px_width); keyBox->addWidget(keystreamPathDisplay); keyBox->addWidget(keystreamButton); QHBoxLayout *saveBox = new QHBoxLayout; QPushButton *saveButton=new QPushButton("Load Save"); connect(saveButton, SIGNAL(clicked()), this, SLOT(on_saveButton_clicked())); savePathDisplay=new QLineEdit; savePathDisplay->setReadOnly(true); savePathDisplay->setMinimumWidth(px_width); saveBox->addWidget(savePathDisplay); saveBox->addWidget(saveButton); //disable this until we have both a keystream and save path decryptButton=new QPushButton("Decrypt Save"); connect(decryptButton, SIGNAL(clicked()), this, SLOT(on_decryptButton_clicked())); decryptButton->setEnabled(false); QPushButton *quitButton=new QPushButton("Quit"); connect(quitButton, SIGNAL(clicked()), this, SLOT(on_quitButton_clicked())); layout->addLayout(versionBox); layout->addLayout(keyBox); layout->addLayout(saveBox); layout->addWidget(decryptButton); layout->addWidget(quitButton); this->setLayout(layout); //! [2] //! [3] //! [4] //mainLayout->addWidget(verticalGroupBox); //! [4] //! [5] //setLayout(mainLayout); setWindowTitle(tr("Pokemon Gen VI Save Decrypter")); }