From 3f154421620f4590aa7a80e10ea9fd991cbfde61 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 6 Feb 2014 16:53:56 +0200 Subject: [PATCH] Remove signal ApplicationDeactivate. --HG-- branch : develop --- src/dialogs/dialogtool.cpp | 12 ----------- src/dialogs/dialogtool.h | 5 ----- src/exception/vexception.cpp | 4 ++-- src/exception/vexception.h | 3 ++- src/mainwindow.cpp | 40 ++++++++---------------------------- src/mainwindow.h | 12 ----------- 6 files changed, 12 insertions(+), 64 deletions(-) diff --git a/src/dialogs/dialogtool.cpp b/src/dialogs/dialogtool.cpp index 45a6890d6..90de7ad28 100644 --- a/src/dialogs/dialogtool.cpp +++ b/src/dialogs/dialogtool.cpp @@ -656,18 +656,6 @@ void DialogTool::UpdateList() } } -void DialogTool::ApplicationDeactivate(bool type) -{ -// if (type == true) -// { -// this->hide(); -// } -// else -// { -// this->show(); -// } -} - template void DialogTool::ShowVariable(const QHash *var) { diff --git a/src/dialogs/dialogtool.h b/src/dialogs/dialogtool.h index bd2bf58e4..ef8346c0d 100644 --- a/src/dialogs/dialogtool.h +++ b/src/dialogs/dialogtool.h @@ -177,11 +177,6 @@ public slots: * @brief UpdateList update lists of variables */ void UpdateList(); - /** - * @brief ApplicationDeactivate hide and show dialog simultaneously with parent window. - * @param type true - hide, false - show window. - */ - void ApplicationDeactivate(bool type); protected: Q_DISABLE_COPY(DialogTool) /** diff --git a/src/exception/vexception.cpp b/src/exception/vexception.cpp index 89ef5189c..9d76e95be 100644 --- a/src/exception/vexception.cpp +++ b/src/exception/vexception.cpp @@ -42,9 +42,9 @@ QString VException::ErrorMessage() const return error; } -void VException::CriticalMessageBox(const QString &situation) const +void VException::CriticalMessageBox(const QString &situation, QWidget * parent) const { - QMessageBox msgBox; + QMessageBox msgBox(parent); msgBox.setWindowTitle("Critical error!"); msgBox.setText(situation); msgBox.setInformativeText(ErrorMessage()); diff --git a/src/exception/vexception.h b/src/exception/vexception.h index 6fb8b5f53..6eea96e64 100644 --- a/src/exception/vexception.h +++ b/src/exception/vexception.h @@ -32,6 +32,7 @@ #include #include +#include /** * @brief The VException class parent for all exception. Could be use for abstract exception @@ -78,7 +79,7 @@ public: * @brief CriticalMessageBox show Critical Message Box. * @param situation main text message box. */ - virtual void CriticalMessageBox(const QString &situation) const; + virtual void CriticalMessageBox(const QString &situation, QWidget *parent = 0) const; protected: /** * @brief what string with error diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 799fb7b2c..2a3c3b78a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -49,6 +49,7 @@ #include #include +//This class need for validation pattern file using XSD shema class MessageHandler : public QAbstractMessageHandler { public: @@ -81,7 +82,6 @@ MainWindow::MainWindow(QWidget *parent) mode(Draw::Calculation), currentDrawIndex(0), currentToolBoxIndex(0), drawMode(true) { ui->setupUi(this); - qApp->installEventFilter(this); static const char * GENERIC_ICON_TO_CHECK = "document-open"; if (QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK) == false) { @@ -288,7 +288,6 @@ void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &curso helpLabel->setText(toolTip); dialogTool = new Dialog(pattern, this); Q_CHECK_PTR(dialogTool); - connect(this, &MainWindow::ApplicationDeactivate, dialogTool, &DialogTool::ApplicationDeactivate); connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChoosedObject); connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip); @@ -1038,29 +1037,6 @@ void MainWindow::Clear() SetEnableTool(false); } -bool MainWindow::eventFilter(QObject *object, QEvent *event) -{ -#ifdef Q_CC_GNU - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wswitch-enum" -#endif - switch(event->type()) - { - case(QEvent::ApplicationDeactivate): - emit ApplicationDeactivate(true); - break; - case(QEvent::ApplicationActivate): - emit ApplicationDeactivate(false); - break; - default: - break; - } -#ifdef Q_CC_GNU - #pragma GCC diagnostic pop -#endif - return QWidget::eventFilter(object, event); -} - void MainWindow::ActionNew() { QProcess *v = new QProcess(this); @@ -1398,35 +1374,35 @@ void MainWindow::OpenPattern(const QString &fileName) } catch (const VExceptionObjectError &e) { - e.CriticalMessageBox(tr("Error parsing file.")); + e.CriticalMessageBox(tr("Error parsing file."), this); file.close(); Clear(); return; } catch (const VExceptionConversionError &e) { - e.CriticalMessageBox(tr("Error can't convert value.")); + e.CriticalMessageBox(tr("Error can't convert value."), this); file.close(); Clear(); return; } catch (const VExceptionEmptyParameter &e) { - e.CriticalMessageBox(tr("Error empty parameter.")); + e.CriticalMessageBox(tr("Error empty parameter."), this); file.close(); Clear(); return; } catch (const VExceptionWrongParameterId &e) { - e.CriticalMessageBox(tr("Error wrong id.")); + e.CriticalMessageBox(tr("Error wrong id."), this); file.close(); Clear(); return; } catch (const VExceptionUniqueId &e) { - e.CriticalMessageBox(tr("Error no unique id.")); + e.CriticalMessageBox(tr("Error no unique id."), this); file.close(); Clear(); return; @@ -1451,7 +1427,7 @@ void MainWindow::OpenPattern(const QString &fileName) } else { - QMessageBox msgBox; + QMessageBox msgBox(this); msgBox.setWindowTitle(tr("Error!")); msgBox.setText(tr("Parsing pattern file error.")); msgBox.setInformativeText(errorMsg); @@ -1467,7 +1443,7 @@ void MainWindow::OpenPattern(const QString &fileName) } else { - QMessageBox msgBox; + QMessageBox msgBox(this); msgBox.setWindowTitle(tr("Error!")); msgBox.setText(tr("Validation file error.")); msgBox.setInformativeText(errorMsg); diff --git a/src/mainwindow.h b/src/mainwindow.h index 89f3f7a91..c67767883 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -361,11 +361,6 @@ signals: * @param listDetails list of details. */ void ModelChosen(QVector listDetails, const QString &fileName); - /** - * @brief ApplicationDeactivate hide and show dialog simultaneously with parent window. - * @param type true - hide, false - show window. - */ - void ApplicationDeactivate(bool type); protected: /** * @brief keyPressEvent handle key press events. @@ -386,13 +381,6 @@ protected: * @brief Clear reset to default window. */ void Clear(); - /** - * @brief eventFilter event filter main window. - * @param object object. - * @param event event - * @return true if accept. - */ - bool eventFilter(QObject* object, QEvent* event); private: Q_DISABLE_COPY(MainWindow) /**