From 1162562d906e174fe06c761b7c9dde3c2d3a4a29 Mon Sep 17 00:00:00 2001 From: x-tools-author Date: Sun, 24 Mar 2024 14:03:29 +0800 Subject: [PATCH] chore: update files of project --- Source/Application.cpp | 14 ++++----- Source/Common/Common/xToolsTableModel.h | 42 +++++++++---------------- Source/main.cpp | 7 +++-- xTools.qrc | 23 ++++++++++++++ 4 files changed, 49 insertions(+), 37 deletions(-) diff --git a/Source/Application.cpp b/Source/Application.cpp index e1e14fbc..cfd1480f 100644 --- a/Source/Application.cpp +++ b/Source/Application.cpp @@ -31,7 +31,7 @@ Application::Application(int argc, char** argv) // It can avoid app crash in this way to show a splashScreen. If you create a QSplashScreen and // show it in the main function, app will crash(test on Ubuntu 16.04). Of course, it is because // that I use a wrong way, also, it could be a bug of Qt. - QPixmap pixmap(":/resources/images/StartUi.jpg"); + QPixmap pixmap(":/Resources/Images/StartUi.jpg"); m_splashScreen = new QSplashScreen(pixmap); showSplashScreenMessage(tr("Initializing...")); m_splashScreen->show(); @@ -41,8 +41,8 @@ Application::Application(int argc, char** argv) int ret = xToolsSettings::instance()->palette(); if ((ret == xToolsDataStructure::PaletteDark) || (ret == xToolsDataStructure::PaletteLight)) { QString fileName = (ret == xToolsDataStructure::PaletteLight - ? ":/resources/palette/SAKAppPaletteLight" - : ":/resources/palette/SAKAppPaletteDark"); + ? ":/Resources/Palettes/DarkPalette" + : ":/Resources/Palettes/DarkPalette"); setupPalette(fileName); } else { QString customPalette = xToolsSettings::instance()->customPalette(); @@ -87,14 +87,14 @@ Application::Application(int argc, char** argv) bool tooHeight = (mainWindow->height() > screenRect.height()); if (tooWidth || tooHeight) { mainWindow->showMaximized(); - qInfo() << "too small screen"; + qInfo() << "The screen is too small."; } else { mainWindow->move((screenRect.width() - mainWindow->width()) / 2, (screenRect.height() - mainWindow->height()) / 2); } showSplashScreenMessage(tr("Finished...")); - QString msg = QString("the size of main window is: %1x%2") + QString msg = QString("The size of main window is: %1x%2") .arg(mainWindow->width()) .arg(mainWindow->height()); qInfo() << qPrintable(msg); @@ -114,8 +114,8 @@ void Application::setupPalette(const QString& fileName) out >> p; file.close(); setPalette(p); - qInfo() << "current palette:" << fileName; + qInfo() << "Current palette is:" << fileName; } else { - qWarning() << "open palette file error:" << file.errorString(); + qWarning() << "Open palette file error:" << file.errorString(); } } diff --git a/Source/Common/Common/xToolsTableModel.h b/Source/Common/Common/xToolsTableModel.h index f13ca38b..074970e8 100644 --- a/Source/Common/Common/xToolsTableModel.h +++ b/Source/Common/Common/xToolsTableModel.h @@ -17,37 +17,25 @@ public: explicit xToolsTableModel(QObject *parent = nullptr); public: - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const final; - virtual int columnCount(const QModelIndex &parent = QModelIndex()) const final; - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const final; - virtual bool setData(const QModelIndex &index, - const QVariant &value, - int role = Qt::EditRole) final; - virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) final; - virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) final; - virtual QVariant headerData(int section, - Qt::Orientation orientation, - int role = Qt::DisplayRole) const final; + // clang-format off + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; + virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; + virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; + virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + // clang-format on signals: // You must connect these signals using Qt::DirectConnection way. + // clang-format off void invokeGetRowCount(int &count); void invokeGetColumnCount(int &count); void invokeGetData(QVariant &data, const QModelIndex &index, int role = Qt::DisplayRole); - void invokeSetData(bool &result, - const QModelIndex &index, - const QVariant &value, - int role = Qt::EditRole); - void invokeInsertRows(bool &result, - int row, - int count, - const QModelIndex &parent = QModelIndex()); - void invokeRemoveRows(bool &result, - int row, - int count, - const QModelIndex &parent = QModelIndex()); - void invokeGetHeaderData(QVariant &data, - int section, - Qt::Orientation orientation, - int role = Qt::DisplayRole); + void invokeSetData(bool &result, const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + void invokeInsertRows(bool &result, int row, int count, const QModelIndex &parent = QModelIndex()); + void invokeRemoveRows(bool &result, int row, int count, const QModelIndex &parent = QModelIndex()); + void invokeGetHeaderData(QVariant &data, int section, Qt::Orientation orientation, int role = Qt::DisplayRole); + // clang-format on }; diff --git a/Source/main.cpp b/Source/main.cpp index a2e204cb..b8509d55 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -6,14 +6,15 @@ * xTools is licensed according to the terms in the file LICENCE(GPL V3) in the root of the source * code directory. **************************************************************************************************/ -#include "xTools.h" #include "Application.h" +#include "xTools.h" int main(const int argc, char *argv[]) { + Q_INIT_RESOURCE(xToolsCommon); QString appName = QString("xTools"); -#ifndef X_TOOLS_IMPORT_MODULE_PRIVATE - appName += QObject::tr("(Community)"); +#ifdef X_TOOLS_BUILD_FOR_STORE + appName += QObject::tr("(Store)"); #endif sakDoSomethingBeforeAppCreated(argv, appName); Application app(argc, argv); diff --git a/xTools.qrc b/xTools.qrc index c7263f38..14328cd5 100644 --- a/xTools.qrc +++ b/xTools.qrc @@ -47,5 +47,28 @@ Resources/Icons/IconZoomOut.svg Resources/Translations/xTools_en.qm Resources/Translations/xTools_zh_CN.qm + Resources/Images/Android.png + Resources/Images/AndroidLogo.png + Resources/Images/Gitee.png + Resources/Images/GitHub.png + Resources/Images/Gz.png + Resources/Images/I18n.png + Resources/Images/iOS.png + Resources/Images/Linux.png + Resources/Images/Logo.jpg + Resources/Images/Logo.png + Resources/Images/Logo.svg + Resources/Images/Mac.png + Resources/Images/MainWindow.png + Resources/Images/Pi.png + Resources/Images/QSAKQQ.jpg + Resources/Images/Qt.png + Resources/Images/QtQQ.jpg + Resources/Images/StartUi.jpg + Resources/Images/WeChat.jpg + Resources/Images/Windows.png + Resources/Images/Zip.png + Resources/Palettes/DarkPalette + Resources/Palettes/LightPalette