void MainWindow::addSessionToMember() { if (!CLLSSListWidget->currentIndex().isValid()) { return; } if (current_db_class == NULL) { return; } if (CLLSListWidget->highlightedRow() < 0) { return; } QDateTime datetime = CLLSSListWidget->currentItem()->data(Qt::UserRole).toDateTime(); Session * session = current_db_sessions.value(datetime); if (!session) return; if (session->numStudents() < 1) { return; } MTListWidget * lw = new MTListWidget; QDialog * d = createAddSessionDialogue(tr("Add selected session"), lw); for (int i = 0; i < session->numStudents(); ++i) { lw->addItem(session->student(i)->name()); } lw->setCurrentRow(0); if (!d->exec()) { delete d; return; } if (lw->currentItem() == NULL) { delete d; return; } current_db_class->member(CLLSListWidget->highlightedRow())->addSession(datetime, lw->currentRow()); setCurrentClassMember(CLLSListWidget->highlightedItem()); CLSCAverageLabel->setText(QString("%1%").arg(current_db_class->average(¤t_db_sessions))); delete d; setDatabaseModified(); }
void MainWindow::restoreSession() { if (!SVSelectedSessionWidget->isEnabled()) { return; } if (current_db_session == NULL) { return; } if (!current_db_session->isArchived()) { return; } ArchivedSession * archived_session = current_db_archivedsessions.value(current_db_session->dateTime()); archived_session->setStatus(ArchivedSession::Remove); current_db_queued_sessions.removeAll(archived_session); current_db_queued_sessions.enqueue(archived_session); Session * session = new Session(archived_session); for (int i = 0; i < SVLASListWidget->count(); ++i) { if (SVLASListWidget->item(i)->data(Qt::UserRole).toDateTime() == current_db_session->dateTime()) { delete SVLASListWidget->item(i); } } current_db_archivedsessions.remove(current_db_session->dateTime()); current_db_sessions.insert(session->dateTime(), session); current_db_session = session; for (int i = 0; i < SVLSListWidget->count(); ++i) { if (SVLSListWidget->item(i)->data(Qt::UserRole).toDateTime() == current_db_session->dateTime()) { delete SVLSListWidget->item(i); } } QListWidgetItem * item = new QListWidgetItem(QString("%1 - %2").arg(session->dateTimeToString()).arg(session->name())); SVLSListWidget->insertItem(0, item); item->setData(Qt::UserRole, session->dateTime()); selectSessionItem(item); setCurrentSession(item); hideArchive(); setDatabaseModified(); }
void MainWindow::updateClassMemberName() { if (current_db_class == NULL) { return; } if (CLLSListWidget->highlightedRow() < 0) { return; } QString name = CLSSNameLineEdit->text(); current_db_class->member(CLLSListWidget->highlightedRow())->setName(name); CLLSListWidget->highlightedItem()->setText(name); setDatabaseModified(); }
void MainWindow::updateClassProperties() { if (current_db_class == NULL) { return; } if (CLLCListWidget->highlightedRow() < 0) { return; } QString name = CLSCNameLineEdit->text(); current_db_class->setName(name); current_db_class->setFirstYear(CLSCFirstYearSpinBox->value()); current_db_class->setLastYear(CLSCLastYearSpinBox->value()); CLLCListWidget->highlightedItem()->setText(QString("%1-%2: %3").arg(current_db_class->firstYear()).arg(current_db_class->lastYear()).arg(current_db_class->name())); setDatabaseModified(); }
void MainWindow::removeSessionFromMember() { if (CLSSResultsTableWidget->currentRow() < 0) { return; } if (current_db_class == NULL) { return; } if (CLLSListWidget->highlightedRow() < 0) { return; } switch (QMessageBox::information(this, tr("Remove session"), tr("Are you sure you want to remove session \"%1\" from the table of results of the selected student? The session will not be deleted from the database.").arg(CLSSResultsTableWidget->item(CLSSResultsTableWidget->currentRow(), 0)->text()), tr("&Remove"), tr("Cancel"), 0, 1)) { case 0: // Remove break; case 1: // Cancel return; break; } current_db_class->member(CLLSListWidget->highlightedRow())->removeSession(CLSSResultsTableWidget->item(CLSSResultsTableWidget->currentRow(), 0)->data(Qt::UserRole).toDateTime()); setCurrentClassMember(CLLSListWidget->highlightedItem()); CLSCAverageLabel->setText(QString("%1%").arg(current_db_class->average(¤t_db_sessions, ¤t_db_archivedsessions))); setDatabaseModified(); }
void MainWindow::deleteLog() { if (!SVSelectedSessionWidget->isEnabled()) return; if (current_db_session == NULL) return; switch (QMessageBox::information(this, tr("Delete log"), tr("Are you sure you want to delete the log for session \"%1 - %2\"?").arg(current_db_session->dateTimeToString()).arg(current_db_session->name()), tr("&Delete"), tr("Cancel"), 0, 1)) { case 0: // Delete break; case 1: // Cancel return; break; } SVLogListWidget->clear(); current_db_session->deleteLog(); SVLogGroupBox->setVisible(false); enableSVTools(); setDatabaseModified(); }
void MainWindow::addClass() { bool ok; QString c_name; addClass_start: c_name = QInputDialog::getText(this, tr("Add class"), tr("Class name:"), QLineEdit::Normal, tr("Class %1").arg(CLLCListWidget->count() + 1), &ok); if (!ok || c_name.isEmpty()) { return; } for (int i = 0; i < CLLCListWidget->count(); ++i) { if (CLLCListWidget->item(i)->text() == c_name) { QMessageBox::information(this, tr("Add class"), tr("A class with this name already exists. Please choose a different name.")); goto addClass_start; } } Class * cl = new Class(c_name); QListWidgetItem * cl_item = new QListWidgetItem(QString("%1-%2: %3").arg(cl->firstYear()).arg(cl->lastYear()).arg(cl->name()), CLLCListWidget); current_db_classes.insert(cl_item, cl); setDatabaseModified(); }
void MainWindow::addSession() { if (!current_db_class) { return; } MTListWidget * lw = new MTListWidget; QDialog * d = createAddSessionDialogue(tr("Add session"), lw); QList<QDateTime> sessions_list; for (int i = 0; i < CLLSSListWidget->count(); ++i) { sessions_list << CLLSSListWidget->item(i)->data(Qt::UserRole).toDateTime(); } QFont font; font.setBold(true); for (int i = 0; i < SVLSListWidget->count(); ++i) { if (sessions_list.contains(SVLSListWidget->item(i)->data(Qt::UserRole).toDateTime())) { continue; } QListWidgetItem * item = new QListWidgetItem(*(SVLSListWidget->item(i))); item->setFont(font); item->setBackground(QBrush(QColor(255, 255, 255))); item->setForeground(QBrush(QColor(0, 0, 0))); lw->addItem(item); } for (int i = 0; i < SVLASListWidget->count(); ++i) { if (sessions_list.contains(SVLASListWidget->item(i)->data(Qt::UserRole).toDateTime())) { continue; } QListWidgetItem * item = new QListWidgetItem(*(SVLASListWidget->item(i))); item->setBackground(QBrush(QColor(255, 255, 255))); item->setForeground(QBrush(QColor(0, 0, 0))); lw->addItem(item); } lw->setCurrentRow(0); if (!d->exec()) { delete d; return; } if (lw->currentItem() == NULL) { delete d; return; } QDateTime datetime = lw->currentItem()->data(Qt::UserRole).toDateTime(); current_db_class->addSession(datetime); QListWidgetItem * item = new QListWidgetItem(*(lw->currentItem())); item->setFont(QFont()); CLLSSListWidget->addItem(item); delete d; setDatabaseModified(); Session * session = current_db_sessions.value(datetime, current_db_archivedsessions.value(datetime, new ArchivedSession(this))); SessionWizard wizard(session, current_db_class, this); wizard.setWindowModality(Qt::WindowModal); wizard.exec(); for (int i = 0; i < wizard.numMatchedPairs(); ++i) { current_db_class->member(wizard.studentNumberInClass(i))->addSession(datetime, wizard.studentNumberInSession(i)); } setCurrentClassMember(CLLSListWidget->highlightedItem()); CLSCAverageLabel->setText(QString("%1%").arg(current_db_class->average(¤t_db_sessions, ¤t_db_archivedsessions))); }
void MainWindow::statsAdjust(QAbstractButton *btn) { QuestionItem *q_item = stats_qmap.value(btn); if (q_item == NULL) return; if (stats_tw == NULL) return; int row = stats_twmap.value(btn, -1); if (row == -1) return; QTableWidgetItem *tw_item = stats_tw->item(row, 1); if (tw_item == NULL) return; int rdif = q_item->recommendedDifficulty(); switch (rdif) { case -1: break; case 0: tw_item->setText(tr("Easy")); tw_item->setBackground(QBrush(QColor(197, 255, 120))); tw_item->setForeground(QBrush(QColor(0, 0, 0))); break; case 1: tw_item->setText(tr("Medium")); tw_item->setBackground(QBrush(QColor(255, 251, 0))); tw_item->setForeground(QBrush(QColor(0, 0, 0))); break; case 2: tw_item->setText(tr("Difficult")); tw_item->setBackground(QBrush(QColor(204, 109, 0))); tw_item->setForeground(QBrush(QColor(0, 0, 0))); break; default: break; } if (rdif >= 0 && rdif <= 2) { q_item->setDifficulty(rdif); if (current_db_questions.value(LQListWidget->currentItem()) == q_item) { SQDifficultyComboBox->setCurrentIndex(rdif); } setDatabaseModified(); btn->setEnabled(false); int i = stats_lwmap.value(btn, -1); if (i == -1) return; QListWidgetItem *lw_item = LQListWidget->item(i); if (lw_item == NULL) return; setQuestionItemIcon(lw_item, rdif); } }
void MainWindow::deleteStudent() { if (current_db_class == NULL) { return; } if (CLLSListWidget->highlightedRow() < 0) { return; } switch (QMessageBox::information(this, tr("Delete student"), tr("Are you sure you want to delete student \"%1\"?").arg(CLLSListWidget->highlightedItem()->text()), tr("&Delete"), tr("Cancel"), 0, 1)) { case 0: // Delete break; case 1: // Cancel return; break; } current_db_class->removeMember(CLLSListWidget->highlightedRow()); delete CLLSListWidget->takeItem(CLLSListWidget->highlightedRow()); CLSCNumStudentsLabel->setText(QString::number(current_db_class->numMembers())); CLSCAverageLabel->setText(QString("%1%").arg(current_db_class->average(¤t_db_sessions, ¤t_db_archivedsessions))); clearCLSS(); togglePrintEnabled(); setDatabaseModified(); }
void MainWindow::deleteSession() { if (current_db_class == NULL) { return; } if (!CLLSSListWidget->currentIndex().isValid()) { return; } switch (QMessageBox::information(this, tr("Delete session"), tr("Are you sure you want to delete session \"%1\" from this class? The session will not be deleted from the database.").arg(CLLSSListWidget->currentItem()->text()), tr("&Delete"), tr("Cancel"), 0, 1)) { case 0: // Delete break; case 1: // Cancel return; break; } QDateTime datetime = CLLSSListWidget->currentItem()->data(Qt::UserRole).toDateTime(); current_db_class->removeSession(datetime); delete CLLSSListWidget->takeItem(CLLSSListWidget->currentRow()); for (int i = 0; i < current_db_class->numMembers(); ++i) { current_db_class->member(i)->removeSession(datetime); } if (CLLSListWidget->highlightedRow() >= 0) { setCurrentClassMember(CLLSListWidget->highlightedItem()); } CLSCAverageLabel->setText(QString("%1%").arg(current_db_class->average(¤t_db_sessions, ¤t_db_archivedsessions))); setDatabaseModified(); }
void MainWindow::addStudent() { if (current_db_class == NULL) { return; } bool ok; QString s_name; addStudent_start: s_name = QInputDialog::getText(this, tr("Add student"), tr("Student name:"), QLineEdit::Normal, tr("Student %1").arg(CLLSListWidget->count() + 1), &ok); if (!ok || s_name.isEmpty()) { return; } for (int i = 0; i < CLLSListWidget->count(); ++i) { if (CLLSListWidget->item(i)->text() == s_name) { switch (QMessageBox::information(this, tr("Add student"), tr("A student with the name \"%1\" already exists in the selected class. Would you like to choose a different name?").arg(s_name), tr("&Use this name anyway"), tr("&Choose a different name"), 0, 1)) { case 0: // Use this name anyway break; case 1: // Choose a different name goto addStudent_start; break; } } } CLLSListWidget->insertItem(current_db_class->addMember(new ClassMember(s_name)), s_name); CLSCNumStudentsLabel->setText(QString::number(current_db_class->numMembers())); setDatabaseModified(); }
void MainWindow::deleteClass() { if (!current_db_class) { return; } QList<QListWidgetItem *> cl_items = current_db_classes.keys(current_db_class); if (cl_items.count() <= 0) { return; } switch (QMessageBox::information(this, tr("Delete class"), tr("Are you sure you want to delete class \"%1\"?").arg(cl_items.at(0)->text()), tr("&Delete"), tr("Cancel"), 0, 1)) { case 0: // Delete break; case 1: // Cancel return; break; } delete current_db_class; for (int i = 0; i < cl_items.count(); ++i) { current_db_classes.remove(cl_items.at(i)); delete cl_items.at(i); } clearCLSC(); togglePrintEnabled(); setDatabaseModified(); }
void MainWindow::applyCategories() { for (int i = EFTreeWidget->topLevelItemCount() - 1; i > 19; --i) { if (EFTreeWidget->topLevelItem(i - 1)->checkState(0) == Qt::Unchecked && EFTreeWidget->topLevelItem(i)->checkState(0) == Qt::Unchecked) { removeCategoryItem(i); } else { break; } } current_db_categories.resize(EFCategoryLineEdit.size()); current_db_categories_enabled.resize(EFCategoryLineEdit.size()); for (int i = 0; i < EFCategoryLineEdit.size(); ++i) { current_db_categories[i] = EFCategoryLineEdit[i]->text(); current_db_categories_enabled[i] = EFTreeWidget->topLevelItem(i)->checkState(0) == Qt::Checked; } setCategories(); updateCategoryQnums(); statusBar()->showMessage(tr("Categories saved"), 10000); setDatabaseModified(); }
void MainWindow::deleteLog() { if (!SVSelectedSessionWidget->isEnabled()) { return; } if (current_db_session == NULL) { return; } switch (QMessageBox::information(this, tr("Delete log"), tr("Are you sure you want to delete the log for session \"%1 - %2\"?").arg(current_db_session->dateTimeToString()).arg(current_db_session->name()), tr("&Delete"), tr("Cancel"), 0, 1)) { case 0: // Delete break; case 1: // Cancel return; break; } SVLogListWidget->clear(); current_db_session->deleteLog(); if (current_db_session->isArchived()) { ArchivedSession * archived_session = current_db_archivedsessions.value(current_db_session->dateTime()); archived_session->setStatus(ArchivedSession::Archive); current_db_queued_sessions.removeAll(archived_session); current_db_queued_sessions.enqueue(archived_session); } SVLogGroupBox->setVisible(false); enableSVTools(); setDatabaseModified(); }
void MainWindow::checkForUncategorisedQuestions() { int numcategories = 0; QuestionItem *item; for (int i = 0; i < current_db_categories.size(); ++i) { if (current_db_categories_enabled[i]) { numcategories++; } } if (numcategories > 0) { for (int i = 0; i < LQListWidget->count(); ++i) { item = current_db_questions.value(LQListWidget->item(i)); if (item->category() == -1) { item->setCategory(SQCategoryComboBox->itemData(0).toInt()); setQuestionItemColour(LQListWidget->item(i), item->category()); setDatabaseModified(); if (LQListWidget->currentRow() == i) { SQCategoryComboBox->setCurrentIndex(current_db_categoryentries.value(item->category())); LQCategoryComboBox->setCurrentIndex(current_db_categoryentries.value(item->category())); } } } } }
MainWindow::MainWindow() { // User interface ---------------------------------------------------------- if (tr("LTR") == "RTL") { qApp->setLayoutDirection(Qt::RightToLeft); } setupUi(this); network_access_manager = new QNetworkAccessManager(this); default_printer = NULL; #ifdef Q_OS_MAC this->setUnifiedTitleAndToolBarOnMac(true); #endif progressBar = new QProgressBar(this); progressBar->setTextVisible(false); progressBar->resize(QSize(30, 10)); statusBar()->addPermanentWidget(progressBar, 0); statusBar()->setFixedHeight(20); progressBar->setFixedWidth(150); progressBar->setFixedHeight(15); progressBar->setVisible(false); LQCategoryComboBox->setVisible(false); SQStatisticsLabel->setVisible(false); currentSvgChanged(); btnApply = SQButtonBox->button(QDialogButtonBox::Apply); btnApply->setText(tr("Apply")); btnApply->setStatusTip(tr("Apply any changes you have made to the question")); btnApply->setIcon(QIcon(QString::fromUtf8(":/images/images/button_ok.png"))); btnDiscard = SQButtonBox->button(QDialogButtonBox::Discard); btnDiscard->setText(tr("Discard")); btnDiscard->setStatusTip(tr("Discard any changes you have made to the question")); btnDiscard->setIcon(QIcon(QString::fromUtf8(":/images/images/button_cancel.png"))); SQQuestionTextEdit->setTitle(tr("Question:")); SQQuestionTextEdit->textEdit()->setStatusTip(tr("Text of the selected question")); ECTextEdit->setTitle(tr("Comments:")); ECTextEdit->textEdit()->setStatusTip(tr("Use this field for your comments, notes, reminders...")); EFTreeWidget->setMouseTracking(true); EFTreeWidget->header()->setSectionResizeMode(0, QHeaderView::Fixed); EFTreeWidget->header()->setSectionResizeMode(1, QHeaderView::Stretch); EFTreeWidget->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); EFButtonBox->button(QDialogButtonBox::Apply)->setText(tr("Apply")); EFButtonBox->button(QDialogButtonBox::Apply)->setStatusTip(tr("Apply any changes you have made to the categories")); EFButtonBox->button(QDialogButtonBox::Apply)->setIcon(QIcon(QString::fromUtf8(":/images/images/button_ok.png"))); EFButtonBox->button(QDialogButtonBox::Discard)->setText(tr("Discard")); EFButtonBox->button(QDialogButtonBox::Discard)->setStatusTip(tr("Discard any changes you have made to the categories")); EFButtonBox->button(QDialogButtonBox::Discard)->setIcon(QIcon(QString::fromUtf8(":/images/images/button_cancel.png"))); // Initialize variables ---------------------------------------------------- // URLs docs_url = tr("http://itest.sourceforge.net/documentation/%1/en/").arg("1.4"); // i18n QTranslator translator; translator.load(":/i18n/iTest-i18n.qm"); itest_i18n.insert("English", "en"); itest_i18n.insert(translator.translate("LanguageNames", "Slovak"), "sk"); itest_i18n.insert(translator.translate("LanguageNames", "Russian"), "ru"); itest_i18n.insert(translator.translate("LanguageNames", "Turkish"), "tr"); itest_i18n.insert(translator.translate("LanguageNames", "Portuguese"), "pt"); itest_i18n.insert(translator.translate("LanguageNames", "Spanish"), "es"); itest_i18n.insert(translator.translate("LanguageNames", "Italian"), "it"); itest_i18n.insert(translator.translate("LanguageNames", "Latvian"), "lv"); itest_i18n.insert(translator.translate("LanguageNames", "Ukrainian"), "uk"); itest_i18n.insert(translator.translate("LanguageNames", "Czech"), "cs"); itest_i18n.insert(translator.translate("LanguageNames", "Hungarian"), "hu"); itest_i18n.insert(translator.translate("LanguageNames", "German"), "de"); // CURRENT_DB current_db_open = false; current_db_session = NULL; current_db_class = NULL; current_db_categories.resize(20); current_db_categories_enabled.resize(20); // Connect slots ----------------------------------------------------------- tbtnAddQuestion->setDefaultAction(actionAdd); tbtnDuplicateQuestion->setDefaultAction(actionDuplicate); tbtnDeleteQuestion->setDefaultAction(actionDelete); QObject::connect(actionAdd, SIGNAL(triggered()), this, SLOT(addQuestion())); QObject::connect(actionDelete, SIGNAL(triggered()), this, SLOT(deleteQuestion())); QObject::connect(actionDuplicate, SIGNAL(triggered()), this, SLOT(duplicateQuestion())); QObject::connect(btnApply, SIGNAL(released()), this, SLOT(applyQuestionChanges())); QObject::connect(actionApply, SIGNAL(triggered()), this, SLOT(applyQuestionChanges())); QObject::connect(btnDiscard, SIGNAL(released()), this, SLOT(discardQuestionChanges())); QObject::connect(actionDiscard, SIGNAL(triggered()), this, SLOT(discardQuestionChanges())); QObject::connect(actionNew, SIGNAL(triggered()), this, SLOT(newDB())); QObject::connect(btnNew, SIGNAL(released()), this, SLOT(newDB())); QObject::connect(actionOpen, SIGNAL(triggered()), this, SLOT(open())); QObject::connect(btnOpenOther, SIGNAL(released()), this, SLOT(open())); QObject::connect(btnOpenSelected, SIGNAL(released()), this, SLOT(openRecent())); QObject::connect(actionSave, SIGNAL(triggered()), this, SLOT(save())); QObject::connect(actionSave_as, SIGNAL(triggered()), this, SLOT(saveAs())); QObject::connect(actionSave_a_copy, SIGNAL(triggered()), this, SLOT(saveCopy())); QObject::connect(actionExport_CSV, SIGNAL(triggered()), this, SLOT(exportCSV())); QObject::connect(actionClose, SIGNAL(triggered()), this, SLOT(closeDB())); QObject::connect(actionQuit, SIGNAL(triggered()), this, SLOT(quit())); QObject::connect(actionAbout, SIGNAL(triggered()), this, SLOT(about())); QObject::connect(recentDBsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(openRecent(QListWidgetItem *))); QObject::connect(LQListWidget, SIGNAL(currentTextChanged(QString)), this, SLOT(setCurrentQuestion())); QObject::connect(actionFrom_A_to_Z, SIGNAL(triggered()), this, SLOT(sortQuestionsAscending())); QObject::connect(actionFrom_Z_to_A, SIGNAL(triggered()), this, SLOT(sortQuestionsDescending())); QObject::connect(actionBy_category, SIGNAL(triggered()), this, SLOT(sortQuestionsByCategory())); tbtnAddSVG->setDefaultAction(actionAdd_SVG); tbtnRemoveSVG->setDefaultAction(actionRemove_SVG); tbtnEditSVG->setDefaultAction(actionEdit_SVG); tbtnExportSVG->setDefaultAction(actionExport_SVG); QObject::connect(actionAdd_SVG, SIGNAL(triggered()), this, SLOT(addSvg())); QObject::connect(actionRemove_SVG, SIGNAL(triggered()), this, SLOT(removeSvg())); QObject::connect(actionEdit_SVG, SIGNAL(triggered()), this, SLOT(editSvg())); QObject::connect(actionExport_SVG, SIGNAL(triggered()), this, SLOT(exportSvg())); QObject::connect(SQSVGListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(previewSvg(QListWidgetItem *))); QObject::connect(SQSVGListWidget, SIGNAL(currentTextChanged(QString)), this, SLOT(currentSvgChanged())); tbtnMoveUp->setDefaultAction(actionMove_up); tbtnMoveDown->setDefaultAction(actionMove_down); QObject::connect(actionMove_up, SIGNAL(triggered()), this, SLOT(moveUp())); QObject::connect(actionMove_down, SIGNAL(triggered()), this, SLOT(moveDown())); QObject::connect(actionMove_to_top, SIGNAL(triggered()), this, SLOT(moveToTop())); QObject::connect(actionMove_to_bottom, SIGNAL(triggered()), this, SLOT(moveToBottom())); QObject::connect(actionHide, SIGNAL(triggered()), this, SLOT(hideQuestion())); QObject::connect(actionShow_hidden, SIGNAL(triggered()), this, SLOT(filterLQSearch())); rbtngrpFilterLQ = new QButtonGroup(this); rbtngrpFilterLQ->addButton(LQAllRadioButton); rbtngrpFilterLQ->addButton(LQEasyRadioButton); rbtngrpFilterLQ->addButton(LQMediumRadioButton); rbtngrpFilterLQ->addButton(LQDifficultRadioButton); rbtngrpFilterLQ->addButton(LQCategoryRadioButton); actgrpFilterLQ = new QActionGroup(this); actgrpFilterLQ->addAction(actionShow_all); actgrpFilterLQ->addAction(actionShow_easy); actgrpFilterLQ->addAction(actionShow_medium); actgrpFilterLQ->addAction(actionShow_difficult); actgrpFilterLQ->addAction(actionShow_category); QObject::connect(rbtngrpFilterLQ, SIGNAL(buttonReleased(QAbstractButton *)), this, SLOT(filterLQ(QAbstractButton *))); QObject::connect(actgrpFilterLQ, SIGNAL(triggered(QAction *)), this, SLOT(filterLQAction(QAction *))); QObject::connect(LQCategoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterLQCategoryChanged())); QObject::connect(LQSearchLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterLQSearch())); QObject::connect(tbtnSearchByGroup, SIGNAL(released()), this, SLOT(searchByGroup())); actgrpPage = new QActionGroup(this); actgrpPage->addAction(actionEdit_questions); actgrpPage->addAction(actionEdit_comments); actgrpPage->addAction(actionEdit_categories); actgrpPage->addAction(actionEdit_test); actgrpPage->addAction(actionSaved_sessions); actgrpPage->addAction(actionEdit_classes); QObject::connect(actgrpPage, SIGNAL(triggered(QAction *)), this, SLOT(setPage(QAction *))); //QObject::connect(btnApply, SIGNAL(released()), this, SLOT(setDatabaseModified())); //QObject::connect(actionApply, SIGNAL(triggered()), this, SLOT(setDatabaseModified())); QObject::connect(ECTextEdit, SIGNAL(textChanged()), this, SLOT(setDatabaseModified())); QObject::connect(actionCheck_for_updates, SIGNAL(triggered()), this, SLOT(checkForUpdates())); QObject::connect(network_access_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(httpRequestFinished(QNetworkReply *))); QObject::connect(actionDocumentation, SIGNAL(triggered()), this, SLOT(openDocumentation())); QObject::connect(SQStatisticsLabel, SIGNAL(linkActivated(QString)), this, SLOT(adjustQuestionDifficulty())); QObject::connect(actionPrint_questions, SIGNAL(triggered()), this, SLOT(showPrintQuestionsDialogue())); QObject::connect(actionOverall_statistics, SIGNAL(triggered()), this, SLOT(overallStatistics())); QObject::connect(actionChange_language, SIGNAL(triggered()), this, SLOT(changeLanguage())); QObject::connect(mainStackedWidget, SIGNAL(currentChanged(int)), this, SLOT(currentPageChanged(int))); // Disable all ------------------------------------------------------------- setAllEnabled(false); // Categories ------------------------------------------------------------------- setupCategoriesPage(); // Server ------------------------------------------------------------------ setupServer(); // Session viewer ---------------------------------------------------------- setupSessionViewer(); // Class viewer ------------------------------------------------------------ setupClassViewer(); // ------------------------------------------------------------------------- #ifdef Q_OS_MAC show(); #endif // Load settings ----------------------------------------------------------- loadSettings(); // Ready ------------------------------------------------------------------- statusBar()->showMessage(tr("Ready"), 10000); // Check app args ---------------------------------------------------------- if (qApp->arguments().count() > 1) { openFile(qApp->arguments().at(1)); } // ------------------------------------------------------------------------- #ifndef Q_OS_MAC show(); #endif }