From 2ffffdfdd813ec1b51f7c8c36860b329fa61ff56 Mon Sep 17 00:00:00 2001 From: Blubbz0r Date: Sat, 18 Apr 2015 17:37:13 +0200 Subject: [PATCH] Refactoring Removed PrintReport and PrintPreview slots from mainwindow. Print actions will instead be directly connected to reultsview. --- gui/mainwindow.cpp | 14 ++------------ gui/mainwindow.h | 12 ------------ gui/resultsview.h | 17 ++++++++++++++--- 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 0d1c22f6a..0ceb8378d 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -77,8 +77,8 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) : connect(mLineEditFilter, SIGNAL(textChanged(const QString&)), mFilterTimer, SLOT(start())); connect(mLineEditFilter, SIGNAL(returnPressed()), this, SLOT(FilterResults())); - connect(mUI.mActionPrint, SIGNAL(triggered()), this, SLOT(PrintReport())); - connect(mUI.mActionPrintPreview, SIGNAL(triggered()), this, SLOT(PrintPreview())); + connect(mUI.mActionPrint, SIGNAL(triggered()), mUI.mResults, SLOT(Print())); + connect(mUI.mActionPrintPreview, SIGNAL(triggered()), mUI.mResults, SLOT(PrintPreview())); connect(mUI.mActionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(mUI.mActionCheckFiles, SIGNAL(triggered()), this, SLOT(CheckFiles())); connect(mUI.mActionCheckDirectory, SIGNAL(triggered()), this, SLOT(CheckDirectory())); @@ -439,16 +439,6 @@ QStringList MainWindow::SelectFilesToCheck(QFileDialog::FileMode mode) return selected; } -void MainWindow::PrintReport() -{ - mUI.mResults->Print(); -} - -void MainWindow::PrintPreview() -{ - mUI.mResults->PrintPreview(); -} - void MainWindow::CheckFiles() { DoCheckFiles(SelectFilesToCheck(QFileDialog::ExistingFiles)); diff --git a/gui/mainwindow.h b/gui/mainwindow.h index ddaffa7ed..b7036331a 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -72,18 +72,6 @@ public: public slots: - /** - * @brief Slot opening a print dialog to print the current report - * - */ - void PrintReport(); - - /** - * @brief Slot opening a print preview dialogPrintPreview - * - */ - void PrintPreview(); - /** * @brief Slot for check files menu item * diff --git a/gui/resultsview.h b/gui/resultsview.h index 7d2046777..75d72f95e 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -76,9 +76,6 @@ public: */ void Save(const QString &filename, Report::Type type) const; - void Print(); - void PrintPreview(); - /** * @brief Update tree settings * @@ -226,8 +223,22 @@ public slots: */ void UpdateDetails(const QModelIndex &index); + /** + * @brief Slot opening a print dialog to print the current report + */ + void Print(); + + /** + * @brief Slot printing the current report to the printer. + * @param printer The printer used for printing the report. + */ void Print(QPrinter* printer); + /** + * @brief Slot opening a print preview dialog + */ + void PrintPreview(); + protected: /** * @brief Have any errors been found