From dc50d24439a62a7f7a71cda1fad6116d35917452 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 20 May 2021 18:33:53 +0300 Subject: [PATCH] Review class VPMainWindow. Setup initial state for a window. User must click New or Open before starting to use the window. --- src/app/puzzle/vpapplication.cpp | 8 +- src/app/puzzle/vpapplication.h | 1 + src/app/puzzle/vpmainwindow.cpp | 232 +++++++++++++++-- src/app/puzzle/vpmainwindow.h | 289 ++++++++++++---------- src/app/puzzle/vpmainwindow.ui | 41 ++- src/app/puzzle/vpsheet.h | 2 - src/app/tape/tmainwindow.cpp | 12 +- src/app/tape/tmainwindow.h | 3 - src/libs/vwidgets/vabstractmainwindow.cpp | 17 ++ src/libs/vwidgets/vabstractmainwindow.h | 4 +- 10 files changed, 424 insertions(+), 185 deletions(-) diff --git a/src/app/puzzle/vpapplication.cpp b/src/app/puzzle/vpapplication.cpp index 0c9e16407..0d3d0e39f 100644 --- a/src/app/puzzle/vpapplication.cpp +++ b/src/app/puzzle/vpapplication.cpp @@ -353,12 +353,18 @@ auto VPApplication::MainWindows() -> QList return list; } +//--------------------------------------------------------------------------------------------------------------------- +VPMainWindow *VPApplication::NewMainWindow() +{ + return NewMainWindow(VPCommandLinePtr()); +} + //--------------------------------------------------------------------------------------------------------------------- auto VPApplication::NewMainWindow(const VPCommandLinePtr &cmd) -> VPMainWindow * { VPMainWindow *puzzle = new VPMainWindow(cmd); mainWindows.prepend(puzzle); - if (cmd->IsGuiEnabled()) + if (not cmd->IsTestModeEnabled()) { puzzle->show(); } diff --git a/src/app/puzzle/vpapplication.h b/src/app/puzzle/vpapplication.h index 5f3f3cc3a..e66e98003 100644 --- a/src/app/puzzle/vpapplication.h +++ b/src/app/puzzle/vpapplication.h @@ -52,6 +52,7 @@ public: virtual bool IsAppInGUIMode() const override; VPMainWindow *MainWindow(); QList MainWindows(); + VPMainWindow *NewMainWindow(); VPMainWindow *NewMainWindow(const VPCommandLinePtr &cmd); void InitOptions(); diff --git a/src/app/puzzle/vpmainwindow.cpp b/src/app/puzzle/vpmainwindow.cpp index 66757cd8a..d944f3720 100644 --- a/src/app/puzzle/vpmainwindow.cpp +++ b/src/app/puzzle/vpmainwindow.cpp @@ -57,31 +57,31 @@ QT_WARNING_POP //--------------------------------------------------------------------------------------------------------------------- VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) : - QMainWindow(parent), + VAbstractMainWindow(parent), ui(new Ui::VPMainWindow), m_cmd(cmd) { m_layout = new VPLayout(); // create a standard sheet - VPSheet *sheet = new VPSheet(m_layout); + auto *sheet = new VPSheet(m_layout); sheet->SetName(QObject::tr("Sheet 1")); m_layout->AddSheet(sheet); m_layout->SetFocusedSheet(); - // ----- for test purposes, to be removed------------------ - sheet->SetSheetMarginsConverted(1, 1, 1, 1); - sheet->SetSheetSizeConverted(84.1, 118.9); - sheet->SetPiecesGapConverted(1); +// // ----- for test purposes, to be removed------------------ +// sheet->SetSheetMarginsConverted(1, 1, 1, 1); +// sheet->SetSheetSizeConverted(84.1, 118.9); +// sheet->SetPiecesGapConverted(1); - m_layout->SetUnit(Unit::Cm); - m_layout->SetWarningSuperpositionOfPieces(true); - m_layout->SetTitle(QString("My Test Layout")); - m_layout->SetDescription(QString("Description of my Layout")); +// m_layout->SetUnit(Unit::Cm); +// m_layout->SetWarningSuperpositionOfPieces(true); +// m_layout->SetTitle(QString("My Test Layout")); +// m_layout->SetDescription(QString("Description of my Layout")); - m_layout->SetTilesSizeConverted(21,29.7); - m_layout->SetTilesOrientation(PageOrientation::Portrait); - m_layout->SetTilesMarginsConverted(1,1,1,1); +// m_layout->SetTilesSizeConverted(21,29.7); +// m_layout->SetTilesOrientation(PageOrientation::Portrait); +// m_layout->SetTilesMarginsConverted(1,1,1,1); // m_layout->SetShowTiles(true); // -------------------------------------------------------- @@ -92,7 +92,7 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) : m_tileFactory = new VPTileFactory(m_layout, VPApplication::VApp()->Settings()); m_tileFactory->refreshTileInfos(); - InitMenuBar(); + SetupMenu(); InitProperties(); InitCarrousel(); @@ -102,9 +102,16 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) : SetPropertiesData(); + UpdateWindowTitle(); ReadSettings(); - +#if defined(Q_OS_MAC) + // Mac OS Dock Menu + QMenu *menu = new QMenu(this); + connect(menu, &QMenu::aboutToShow, this, &VPMainWindow::AboutToShowDockMenu); + AboutToShowDockMenu(); + menu->setAsDockMenu(); +#endif //defined(Q_OS_MAC) } //--------------------------------------------------------------------------------------------------------------------- @@ -232,13 +239,17 @@ VPPiece* VPMainWindow::CreatePiece(const VLayoutPiece &rawPiece) } //--------------------------------------------------------------------------------------------------------------------- -void VPMainWindow::InitMenuBar() +void VPMainWindow::SetupMenu() { // most of the actions are connected through name convention (auto-connection) - // -------------------- connects the actions for the file menu + ui->actionNew->setShortcuts(QKeySequence::New); + ui->actionSave->setShortcuts(QKeySequence::Save); + ui->actionSaveAs->setShortcuts(QKeySequence::SaveAs); + connect(ui->actionExit, &QAction::triggered, this, &VPMainWindow::close); + ui->actionExit->setShortcuts(QKeySequence::Quit); // -------------------- connects the actions for the edit menu // TODO : initialise the undo / redo @@ -410,6 +421,7 @@ void VPMainWindow::InitPropertyTabLayout() void VPMainWindow::InitCarrousel() { m_carrousel = new VPCarrousel(m_layout, ui->dockWidgetCarrousel); + m_carrousel->setDisabled(true); ui->dockWidgetCarrousel->setWidget(m_carrousel); connect(ui->dockWidgetCarrousel, QOverload::of(&QDockWidget::dockLocationChanged), this, @@ -578,6 +590,7 @@ void VPMainWindow::SetPropertyTabLayoutData() void VPMainWindow::InitMainGraphics() { m_graphicsView = new VPMainGraphicsView(m_layout, m_tileFactory, this); + m_graphicsView->setDisabled(true); ui->centralWidget->layout()->addWidget(m_graphicsView); m_graphicsView->RefreshLayout(); @@ -594,10 +607,7 @@ void VPMainWindow::InitZoomToolBar() delete m_doubleSpinBoxScale; } - if (m_mouseCoordinate != nullptr) - { - delete m_mouseCoordinate; - } + delete m_mouseCoordinate; // connect the zoom buttons and shortcuts to the slots QList zoomInShortcuts; @@ -625,12 +635,13 @@ void VPMainWindow::InitZoomToolBar() // defined the scale ui->toolBarZoom->addSeparator(); - QLabel* zoomScale = new QLabel(tr("Scale:"), this); + auto* zoomScale = new QLabel(tr("Scale:"), this); ui->toolBarZoom->addWidget(zoomScale); m_doubleSpinBoxScale = new QDoubleSpinBox(this); m_doubleSpinBoxScale->setDecimals(1); m_doubleSpinBoxScale->setSuffix("%"); + m_doubleSpinBoxScale->setDisabled(true); on_ScaleChanged(m_graphicsView->transform().m11()); connect(m_doubleSpinBoxScale.data(), QOverload::of(&QDoubleSpinBox::valueChanged), this, [this](double d){m_graphicsView->Zoom(d/100.0);}); @@ -661,6 +672,62 @@ void VPMainWindow::SetCheckBoxValue(QCheckBox *checkbox, bool value) checkbox->blockSignals(false); } +//--------------------------------------------------------------------------------------------------------------------- +void VPMainWindow::UpdateWindowTitle() +{ + QString showName; + bool isFileWritable = true; + if (not curFile.isEmpty()) + { +#ifdef Q_OS_WIN32 + qt_ntfs_permission_lookup++; // turn checking on +#endif /*Q_OS_WIN32*/ + isFileWritable = QFileInfo(curFile).isWritable(); +#ifdef Q_OS_WIN32 + qt_ntfs_permission_lookup--; // turn it off again +#endif /*Q_OS_WIN32*/ + showName = StrippedName(curFile); + } + else + { + showName = tr("untitled %1.vlt").arg(VPApplication::VApp()->MainWindows().size()+1); + } + + showName += QLatin1String("[*]"); + + if (lIsReadOnly || not isFileWritable) + { + showName += QStringLiteral(" (") + tr("read only") + QChar(')'); + } + + setWindowTitle(showName); + setWindowFilePath(curFile); + +#if defined(Q_OS_MAC) + static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/layout.icns")); + QIcon icon; + if (not curFile.isEmpty()) + { + if (not isWindowModified()) + { + icon = fileIcon; + } + else + { + static QIcon darkIcon; + + if (darkIcon.isNull()) + { + darkIcon = QIcon(darkenPixmap(fileIcon.pixmap(16, 16))); + } + icon = darkIcon; + } + } + setWindowIcon(icon); +#endif //defined(Q_OS_MAC) +} + //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::ReadSettings() { @@ -673,6 +740,9 @@ void VPMainWindow::ReadSettings() restoreState(settings->GetWindowState()); restoreState(settings->GetToolbarsState(), APP_VERSION); + // Text under tool buton icon + ToolBarStyles(); + ui->dockWidgetProperties->setVisible(settings->IsDockWidgetPropertiesActive()); ui->dockWidgetPropertiesContents->setVisible(settings->IsDockWidgetPropertiesContentsActive()); @@ -828,6 +898,42 @@ void VPMainWindow::generateTiledPdf(QString fileName) } } +//--------------------------------------------------------------------------------------------------------------------- +void VPMainWindow::CreateWindowMenu(QMenu *menu) +{ + SCASSERT(menu != nullptr) + + QAction *action = menu->addAction(tr("&New Window")); + connect(action, &QAction::triggered, this, []() + { + VPApplication::VApp()->NewMainWindow()->activateWindow(); + }); + action->setMenuRole(QAction::NoRole); + menu->addSeparator(); + + const QList windows = VPApplication::VApp()->MainWindows(); + for (int i = 0; i < windows.count(); ++i) + { + VPMainWindow *window = windows.at(i); + + QString title = QStringLiteral("%1. %2").arg(i+1).arg(window->windowTitle()); + const int index = title.lastIndexOf(QLatin1String("[*]")); + if (index != -1) + { + window->isWindowModified() ? title.replace(index, 3, QChar('*')) : title.replace(index, 3, QString()); + } + + QAction *action = menu->addAction(title, this, &VPMainWindow::ShowWindow); + action->setData(i); + action->setCheckable(true); + action->setMenuRole(QAction::NoRole); + if (window->isActiveWindow()) + { + action->setChecked(true); + } + } +} + //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::on_actionNew_triggered() @@ -868,6 +974,27 @@ void VPMainWindow::closeEvent(QCloseEvent *event) } } +//--------------------------------------------------------------------------------------------------------------------- +void VPMainWindow::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + { + WindowsLocale(); + + // retranslate designer form (single inheritance approach) + ui->retranslateUi(this); + } + + // remember to call base class implementation + QMainWindow::changeEvent(event); +} + +//--------------------------------------------------------------------------------------------------------------------- +QStringList VPMainWindow::RecentFileList() const +{ + return VPApplication::VApp()->PuzzleSettings()->GetRecentFileList(); +} + //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::on_actionOpen_triggered() { @@ -1538,3 +1665,64 @@ void VPMainWindow::on_MouseMoved(const QPointF &scenePos) .arg(UnitsToStr(m_layout->GetUnit(), true))); } } + +//--------------------------------------------------------------------------------------------------------------------- +void VPMainWindow::ShowWindow() const +{ + if (auto *action = qobject_cast(sender())) + { + const QVariant v = action->data(); + if (v.canConvert()) + { + const int offset = qvariant_cast(v); + const QList windows = VPApplication::VApp()->MainWindows(); + windows.at(offset)->raise(); + windows.at(offset)->activateWindow(); + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPMainWindow::Preferences() +{ + // Calling constructor of the dialog take some time. Because of this user have time to call the dialog twice. +// static QPointer guard;// Prevent any second run +// if (guard.isNull()) +// { +// QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); +// auto *preferences = new DialogPuzzlePreferences(this); +// // QScopedPointer needs to be sure any exception will never block guard +// QScopedPointer dlg(preferences); +// guard = preferences; +// // Must be first +// connect(dlg.data(), &DialogPuzzlePreferences::UpdateProperties, this, &VPMainWindow::WindowsLocale); +// connect(dlg.data(), &DialogPuzzlePreferences::UpdateProperties, this, &VPMainWindow::ToolBarStyles); +// QGuiApplication::restoreOverrideCursor(); +// dlg->exec(); + // } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPMainWindow::ToolBarStyles() +{ + ToolBarStyle(ui->mainToolBar); + ToolBarStyle(ui->toolBarZoom); +} + +//--------------------------------------------------------------------------------------------------------------------- +#if defined(Q_OS_MAC) +void VPMainWindow::AboutToShowDockMenu() +{ + if (QMenu *menu = qobject_cast(sender())) + { + menu->clear(); + CreateWindowMenu(menu); + + menu->addSeparator(); + + QAction *actionPreferences = menu->addAction(tr("Preferences")); + actionPreferences->setMenuRole(QAction::NoRole); + connect(actionPreferences, &QAction::triggered, this, &VPMainWindow::Preferences); + } +} +#endif //defined(Q_OS_MAC) diff --git a/src/app/puzzle/vpmainwindow.h b/src/app/puzzle/vpmainwindow.h index 1862bc126..a26bda72b 100644 --- a/src/app/puzzle/vpmainwindow.h +++ b/src/app/puzzle/vpmainwindow.h @@ -42,13 +42,14 @@ #include "vptilefactory.h" #include "vpcommandline.h" #include "../vlayout/vlayoutdef.h" +#include "../vwidgets/vabstractmainwindow.h" namespace Ui { class VPMainWindow; } -class VPMainWindow : public QMainWindow +class VPMainWindow : public VAbstractMainWindow { Q_OBJECT @@ -90,142 +91,9 @@ public slots: void on_actionNew_triggered(); protected: - enum { MaxRecentFiles = 5 }; - virtual void closeEvent(QCloseEvent *event) override; - -private: - Q_DISABLE_COPY(VPMainWindow) - Ui::VPMainWindow *ui; - - VPCarrousel *m_carrousel{nullptr}; - VPMainGraphicsView *m_graphicsView{nullptr}; - - VPCommandLinePtr m_cmd; - - VPLayout *m_layout{nullptr}; - QListm_selectedPieces{QList()}; - - VPTileFactory *m_tileFactory{nullptr}; - - /** - * @brief spin box with the scale factor of the graphic view - */ - QPointer m_doubleSpinBoxScale{nullptr}; - - /** - * @brief mouseCoordinate pointer to label who show mouse coordinate. - */ - QLabel* m_mouseCoordinate{nullptr}; - - /** - * @brief CreatePiece creates a piece from the given VLayoutPiece data - * @param rawPiece the raw piece data - */ - VPPiece* CreatePiece(const VLayoutPiece &rawPiece); - - /** - * @brief InitMenuBar Inits the menu bar (File, Edit, Help ...) - */ - void InitMenuBar(); - - /** - * @brief InitProperties Init the properties - */ - void InitProperties(); - - /** - * @brief InitPropertyTabCurrentPiece Inits the current piece tab in the properties - */ - void InitPropertyTabCurrentPiece(); - - /** - * @brief InitPropertyTabCurrentSheet Inits the current sheet tab in the properties; - */ - void InitPropertyTabCurrentSheet(); - - /** - * @brief InitPropertyTabLayout Inits the layout tab in the properties - */ - void InitPropertyTabLayout(); - - /** - * @brief InitPropertyTabTiles Inits the tiles tab in the properties - */ - void InitPropertyTabTiles(); - - /** - * @brief InitCarrousel Inits the carrousel - */ - void InitCarrousel(); - - /** - * @brief InitMainGraphics Initialises the puzzle main graphics - */ - void InitMainGraphics(); - - /** - * @brief InitToolBar Initialises the tool bar - */ - void InitZoomToolBar(); - - /** - * @brief SetPropertiesData Sets the values of UI elements - * in all the property tabs to the values saved in m_layout - */ - void SetPropertiesData(); - - /** - * @brief SetPropertyTabCurrentPieceData Sets the values of UI elements - * in the Current Piece Tab to the values saved in m_layout - */ - void SetPropertyTabCurrentPieceData(); - - /** - * @brief SetPropertyTabSheetData Sets the values of UI elements - * in the Sheet Tab to the values saved in focused sheet - */ - void SetPropertyTabSheetData(); - - /** - * @brief SetPropertyTabTilesData Sets the values of UI elements - * in the Tiles Tab to the values saved in m_layout - */ - void SetPropertyTabTilesData(); - - /** - * @brief SetPropertyTabLayoutData Sets the values of UI elements - * in the Layout Tab to the values saved in m_layout - */ - void SetPropertyTabLayoutData(); - - /** - * @brief SetDoubleSpinBoxValue sets the given spinbox to the given value. - * the signals are blocked before changing the value and unblocked after - * @param spinBox pointer to spinbox - * @param value spinbox value - */ - void SetDoubleSpinBoxValue(QDoubleSpinBox *spinBox, qreal value); - - /** - * @brief SetCheckBoxValue sets the given checkbox to the given value. - * the signals are blocked before changing the value and unblocked after - * @param checkbox pointer to checkbox - * @param value checkbox value - */ - void SetCheckBoxValue(QCheckBox *checkbox, bool value); - - void ReadSettings(); - void WriteSettings(); - - bool MaybeSave(); - - /** - * @brief generateTiledPdf Generates the tiled Pdf in the given filename - * @param fileName output file name - */ - void generateTiledPdf(QString fileName); - + virtual void changeEvent(QEvent* event) override; + virtual QStringList RecentFileList() const override; private slots: /** @@ -521,6 +389,155 @@ private slots: * @param scenePos position mouse. */ void on_MouseMoved(const QPointF &scenePos); + + void ShowWindow() const; + void Preferences(); + void ToolBarStyles(); + +#if defined(Q_OS_MAC) + void AboutToShowDockMenu(); +#endif //defined(Q_OS_MAC) + +private: + Q_DISABLE_COPY(VPMainWindow) + Ui::VPMainWindow *ui; + + VPCarrousel *m_carrousel{nullptr}; + VPMainGraphicsView *m_graphicsView{nullptr}; + + VPCommandLinePtr m_cmd; + + VPLayout *m_layout{nullptr}; + QListm_selectedPieces{QList()}; + + VPTileFactory *m_tileFactory{nullptr}; + + /** + * @brief spin box with the scale factor of the graphic view + */ + QPointer m_doubleSpinBoxScale{nullptr}; + + /** + * @brief mouseCoordinate pointer to label who show mouse coordinate. + */ + QLabel* m_mouseCoordinate{nullptr}; + + QString curFile{}; + + bool isInitialized{false}; + bool lIsReadOnly{false}; + + /** + * @brief CreatePiece creates a piece from the given VLayoutPiece data + * @param rawPiece the raw piece data + */ + VPPiece* CreatePiece(const VLayoutPiece &rawPiece); + + /** + * @brief InitMenuBar Inits the menu bar (File, Edit, Help ...) + */ + void SetupMenu(); + + /** + * @brief InitProperties Init the properties + */ + void InitProperties(); + + /** + * @brief InitPropertyTabCurrentPiece Inits the current piece tab in the properties + */ + void InitPropertyTabCurrentPiece(); + + /** + * @brief InitPropertyTabCurrentSheet Inits the current sheet tab in the properties; + */ + void InitPropertyTabCurrentSheet(); + + /** + * @brief InitPropertyTabLayout Inits the layout tab in the properties + */ + void InitPropertyTabLayout(); + + /** + * @brief InitPropertyTabTiles Inits the tiles tab in the properties + */ + void InitPropertyTabTiles(); + + /** + * @brief InitCarrousel Inits the carrousel + */ + void InitCarrousel(); + + /** + * @brief InitMainGraphics Initialises the puzzle main graphics + */ + void InitMainGraphics(); + + /** + * @brief InitToolBar Initialises the tool bar + */ + void InitZoomToolBar(); + + /** + * @brief SetPropertiesData Sets the values of UI elements + * in all the property tabs to the values saved in m_layout + */ + void SetPropertiesData(); + + /** + * @brief SetPropertyTabCurrentPieceData Sets the values of UI elements + * in the Current Piece Tab to the values saved in m_layout + */ + void SetPropertyTabCurrentPieceData(); + + /** + * @brief SetPropertyTabSheetData Sets the values of UI elements + * in the Sheet Tab to the values saved in focused sheet + */ + void SetPropertyTabSheetData(); + + /** + * @brief SetPropertyTabTilesData Sets the values of UI elements + * in the Tiles Tab to the values saved in m_layout + */ + void SetPropertyTabTilesData(); + + /** + * @brief SetPropertyTabLayoutData Sets the values of UI elements + * in the Layout Tab to the values saved in m_layout + */ + void SetPropertyTabLayoutData(); + + /** + * @brief SetDoubleSpinBoxValue sets the given spinbox to the given value. + * the signals are blocked before changing the value and unblocked after + * @param spinBox pointer to spinbox + * @param value spinbox value + */ + void SetDoubleSpinBoxValue(QDoubleSpinBox *spinBox, qreal value); + + /** + * @brief SetCheckBoxValue sets the given checkbox to the given value. + * the signals are blocked before changing the value and unblocked after + * @param checkbox pointer to checkbox + * @param value checkbox value + */ + void SetCheckBoxValue(QCheckBox *checkbox, bool value); + + void UpdateWindowTitle(); + + void ReadSettings(); + void WriteSettings(); + + bool MaybeSave(); + + /** + * @brief generateTiledPdf Generates the tiled Pdf in the given filename + * @param fileName output file name + */ + void generateTiledPdf(QString fileName); + + void CreateWindowMenu(QMenu *menu); }; #endif // VPMAINWINDOW_H diff --git a/src/app/puzzle/vpmainwindow.ui b/src/app/puzzle/vpmainwindow.ui index 7d859a45c..418a562cf 100644 --- a/src/app/puzzle/vpmainwindow.ui +++ b/src/app/puzzle/vpmainwindow.ui @@ -175,6 +175,9 @@ + + false + 0 @@ -1561,7 +1564,8 @@ - + + .. &Open @@ -1572,10 +1576,11 @@ - true + false - + + .. &Save @@ -1586,10 +1591,11 @@ - true + false - + + .. Save &As @@ -1600,7 +1606,7 @@ - true + false &Close Layout @@ -1608,7 +1614,7 @@ - true + false &Import Raw Layout Data @@ -1634,7 +1640,8 @@ - + + .. &New @@ -1653,7 +1660,8 @@ - + + .. About &Puzzle @@ -1669,6 +1677,9 @@ true + + false + Properties @@ -1677,6 +1688,9 @@ + + false + .. @@ -1686,6 +1700,9 @@ + + false + .. @@ -1695,6 +1712,9 @@ + + false + .. @@ -1704,6 +1724,9 @@ + + false + .. diff --git a/src/app/puzzle/vpsheet.h b/src/app/puzzle/vpsheet.h index 5558b0a94..ecbefc919 100644 --- a/src/app/puzzle/vpsheet.h +++ b/src/app/puzzle/vpsheet.h @@ -70,8 +70,6 @@ class VPSheet : public QObject { Q_OBJECT public: - - explicit VPSheet(VPLayout* layout); ~VPSheet(); diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index e93e86962..fc9b63a8f 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -388,13 +388,6 @@ bool TMainWindow::LoadFile(const QString &path) return true; } -//--------------------------------------------------------------------------------------------------------------------- -void TMainWindow::ShowToolTip(const QString &toolTip) -{ - Q_UNUSED(toolTip) - // do nothing -} - //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::FileNew() { @@ -597,7 +590,7 @@ void TMainWindow::changeEvent(QEvent *event) { if (event->type() == QEvent::LanguageChange) { - VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c()); + WindowsLocale(); // retranslate designer form (single inheritance approach) ui->retranslateUi(this); @@ -2410,7 +2403,6 @@ void TMainWindow::SetupMenu() m_separatorAct->setVisible(false); ui->menuFile->insertAction(ui->actionPreferences, m_separatorAct ); - connect(ui->actionQuit, &QAction::triggered, this, &TMainWindow::close); ui->actionQuit->setShortcuts(QKeySequence::Quit); @@ -3653,7 +3645,7 @@ void TMainWindow::CreateWindowMenu(QMenu *menu) window->isWindowModified() ? title.replace(index, 3, QChar('*')) : title.replace(index, 3, QString()); } - QAction *action = menu->addAction(title, this, SLOT(ShowWindow())); + QAction *action = menu->addAction(title, this, &TMainWindow::ShowWindow); action->setData(i); action->setCheckable(true); action->setMenuRole(QAction::NoRole); diff --git a/src/app/tape/tmainwindow.h b/src/app/tape/tmainwindow.h index d8040d6f3..6fa275b0d 100644 --- a/src/app/tape/tmainwindow.h +++ b/src/app/tape/tmainwindow.h @@ -65,9 +65,6 @@ public: bool LoadFile(const QString &path); -public slots: - virtual void ShowToolTip(const QString &toolTip) override; - protected: virtual void closeEvent(QCloseEvent *event) override; virtual void changeEvent(QEvent* event) override; diff --git a/src/libs/vwidgets/vabstractmainwindow.cpp b/src/libs/vwidgets/vabstractmainwindow.cpp index ff5616f33..c4c259f86 100644 --- a/src/libs/vwidgets/vabstractmainwindow.cpp +++ b/src/libs/vwidgets/vabstractmainwindow.cpp @@ -134,6 +134,13 @@ VAbstractMainWindow::VAbstractMainWindow(QWidget *parent) } } +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractMainWindow::ShowToolTip(const QString &toolTip) +{ + Q_UNUSED(toolTip) + // do nothing +} + //--------------------------------------------------------------------------------------------------------------------- bool VAbstractMainWindow::ContinueFormatRewrite(const QString ¤tFormatVersion, const QString &maxFormatVersion) @@ -197,6 +204,16 @@ QString VAbstractMainWindow::CSVFilePath() return fileName; } +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractMainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int mib, const QChar &separator) +{ + Q_UNUSED(fileName) + Q_UNUSED(withHeader) + Q_UNUSED(mib) + Q_UNUSED(separator) + // do nothing +} + //--------------------------------------------------------------------------------------------------------------------- void VAbstractMainWindow::UpdateRecentFileActions() { diff --git a/src/libs/vwidgets/vabstractmainwindow.h b/src/libs/vwidgets/vabstractmainwindow.h index ad0e4e526..070201708 100644 --- a/src/libs/vwidgets/vabstractmainwindow.h +++ b/src/libs/vwidgets/vabstractmainwindow.h @@ -45,7 +45,7 @@ public: virtual ~VAbstractMainWindow() Q_DECL_EQ_DEFAULT; public slots: - virtual void ShowToolTip(const QString &toolTip)=0; + virtual void ShowToolTip(const QString &toolTip); virtual void UpdateVisibilityGroups(); virtual void UpdateDetailsList(); virtual void ZoomFitBestCurrent(); @@ -66,7 +66,7 @@ protected: QString CSVFilePath(); - virtual void ExportToCSVData(const QString &fileName, bool withHeader, int mib, const QChar &separator)=0; + virtual void ExportToCSVData(const QString &fileName, bool withHeader, int mib, const QChar &separator); virtual QStringList RecentFileList() const =0; void UpdateRecentFileActions();