chore: update files of project

This commit is contained in:
x-tools-author 2024-03-24 14:03:29 +08:00
parent 9b9fb82f75
commit 1162562d90
4 changed files with 49 additions and 37 deletions

View File

@ -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();
}
}

View File

@ -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
};

View File

@ -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);

View File

@ -47,5 +47,28 @@
<file>Resources/Icons/IconZoomOut.svg</file>
<file>Resources/Translations/xTools_en.qm</file>
<file>Resources/Translations/xTools_zh_CN.qm</file>
<file>Resources/Images/Android.png</file>
<file>Resources/Images/AndroidLogo.png</file>
<file>Resources/Images/Gitee.png</file>
<file>Resources/Images/GitHub.png</file>
<file>Resources/Images/Gz.png</file>
<file>Resources/Images/I18n.png</file>
<file>Resources/Images/iOS.png</file>
<file>Resources/Images/Linux.png</file>
<file>Resources/Images/Logo.jpg</file>
<file>Resources/Images/Logo.png</file>
<file>Resources/Images/Logo.svg</file>
<file>Resources/Images/Mac.png</file>
<file>Resources/Images/MainWindow.png</file>
<file>Resources/Images/Pi.png</file>
<file>Resources/Images/QSAKQQ.jpg</file>
<file>Resources/Images/Qt.png</file>
<file>Resources/Images/QtQQ.jpg</file>
<file>Resources/Images/StartUi.jpg</file>
<file>Resources/Images/WeChat.jpg</file>
<file>Resources/Images/Windows.png</file>
<file>Resources/Images/Zip.png</file>
<file>Resources/Palettes/DarkPalette</file>
<file>Resources/Palettes/LightPalette</file>
</qresource>
</RCC>