mirror of
https://github.com/x-tools-author/x-tools.git
synced 2025-09-15 15:28:40 +08:00
chore: update files of project
This commit is contained in:
parent
cd03a0a7cb
commit
126eba3bc7
@ -1,12 +1,12 @@
|
||||
add_compile_definitions(SAK_AUTHOR="Qsaker")
|
||||
add_compile_definitions(X_TOOLS_AUTHOR="x-tools-author")
|
||||
add_compile_definitions(SAK_EDITION="beta1")
|
||||
add_compile_definitions(SAK_VERSION="5.1.0")
|
||||
add_compile_definitions(SAK_STYLE_DEFAULT="Fusion")
|
||||
add_compile_definitions(SAK_HOST_ADDRESS_ANY="Any")
|
||||
add_compile_definitions(SAK_CLEAR_MESSAGE_INTERVAL=8000)
|
||||
add_compile_definitions(SAK_AUTHOR_EMAIL="qsaker@foxmail.com")
|
||||
add_compile_definitions(SAK_GITEE_REPOSITORY_URL="https://gitee.com/qsaker/xTools")
|
||||
add_compile_definitions(SAK_GITHUB_REPOSITORY_URL="https://github.com/qsaker/xTools")
|
||||
add_compile_definitions(X_TOOLS_AUTHOR_EMAIL="x-tools@outlook.com")
|
||||
add_compile_definitions(X_TOOLS_GITEE_REPOSITORY_URL="https://gitee.com/x-tools-author/x-tools")
|
||||
add_compile_definitions(X_TOOLS_GITHUB_REPOSITORY_URL="https://github.com/x-tools-author/x-tools")
|
||||
|
||||
set(SAK_BINARY_DIR ${CMAKE_BINARY_DIR}/assets)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# Get the last tag.
|
||||
function(sak_git_get_last_tag working_dir prefix)
|
||||
function(x_tools_git_get_latest_tag working_dir prefix)
|
||||
execute_process(
|
||||
COMMAND git describe --abbrev=0 --tags
|
||||
WORKING_DIRECTORY ${working_dir}
|
||||
@ -11,7 +11,7 @@ function(sak_git_get_last_tag working_dir prefix)
|
||||
endfunction()
|
||||
|
||||
# Get the last commit.
|
||||
function(sak_git_get_last_commit working_dir prefix)
|
||||
function(x_tools_git_get_latest_commit working_dir prefix)
|
||||
execute_process(
|
||||
COMMAND git log -1 --pretty=%H
|
||||
WORKING_DIRECTORY ${working_dir}
|
||||
@ -22,7 +22,7 @@ function(sak_git_get_last_commit working_dir prefix)
|
||||
endfunction()
|
||||
|
||||
# Get last commit time.
|
||||
function(sak_git_get_last_commit_time working_dir prefix)
|
||||
function(x_tools_git_get_latest_commit_time working_dir prefix)
|
||||
execute_process(
|
||||
COMMAND git log -1 --format=%cd
|
||||
WORKING_DIRECTORY ${working_dir}
|
||||
|
||||
@ -33,6 +33,9 @@ include(CMake/xToolsCommon.cmake)
|
||||
include(CMake/xToolsGitInfo.cmake)
|
||||
include(CMake/xToolsDeployQt.cmake)
|
||||
|
||||
x_tools_git_get_latest_commit(${CMAKE_SOURCE_DIR} "X_TOOLS")
|
||||
x_tools_git_get_latest_commit_time(${CMAKE_SOURCE_DIR} "X_TOOLS")
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# Common module
|
||||
include_directories(${CMAKE_SOURCE_DIR}/Source/Common/Common)
|
||||
@ -150,8 +153,6 @@ x_tools_add_third_party("qmdnsengine-master")
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/Source/Private)
|
||||
|
||||
x_tools_add_executable(xTools ${X_TOOLS_SOURCE})
|
||||
sak_git_get_last_commit(${CMAKE_SOURCE_DIR} "SAK")
|
||||
sak_git_get_last_commit_time(${CMAKE_SOURCE_DIR} "SAK")
|
||||
x_tools_generate_translations(xTools)
|
||||
|
||||
target_link_libraries(xTools PRIVATE glog::glog)
|
||||
|
||||
@ -99,19 +99,12 @@ void xToolsMainWindow::initMenuHelp()
|
||||
{
|
||||
QMenuBar* menu_bar = menuBar();
|
||||
m_helpMenu = menu_bar->addMenu(tr("&Help"));
|
||||
m_helpMenu->addAction(QIcon(":/resources/images/GitHub.png"),
|
||||
"Github",
|
||||
this,
|
||||
&xToolsMainWindow::onGithubActionTriggered);
|
||||
m_helpMenu->addAction(QIcon(":/resources/images/Gitee.png"),
|
||||
"Gitee",
|
||||
this,
|
||||
&xToolsMainWindow::onGiteeActionTriggered);
|
||||
m_helpMenu->addAction(QIcon(":/Resources/Icons/IconQQ.svg"),
|
||||
tr("User QQ Group"),
|
||||
this,
|
||||
&xToolsMainWindow::onUserQqGroupTriggerd);
|
||||
m_helpMenu->addAction(tr("&About"), this, &xToolsMainWindow::onAboutActionTriggered);
|
||||
m_aboutAction = m_helpMenu->addAction(tr("&About"),
|
||||
this,
|
||||
&xToolsMainWindow::onAboutActionTriggered);
|
||||
m_aboutQtAction = m_helpMenu->addAction(tr("About Qt"), this, [=]() {
|
||||
QMessageBox::aboutQt(this, tr("About Qt"));
|
||||
});
|
||||
}
|
||||
|
||||
void xToolsMainWindow::initOptionMenuAppStyleMenu()
|
||||
@ -235,18 +228,18 @@ void xToolsMainWindow::onHdpiPolicyActionTriggered(int policy)
|
||||
|
||||
void xToolsMainWindow::onGithubActionTriggered()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl(SAK_GITHUB_REPOSITORY_URL));
|
||||
QDesktopServices::openUrl(QUrl(X_TOOLS_GITHUB_REPOSITORY_URL));
|
||||
}
|
||||
|
||||
void xToolsMainWindow::onGiteeActionTriggered()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl(SAK_GITEE_REPOSITORY_URL));
|
||||
QDesktopServices::openUrl(QUrl(X_TOOLS_GITEE_REPOSITORY_URL));
|
||||
}
|
||||
|
||||
void xToolsMainWindow::onUserQqGroupTriggerd()
|
||||
{
|
||||
QPixmap pix;
|
||||
if (!pix.load(":/resources/images/QSAKQQ.jpg")) {
|
||||
if (!pix.load(":/Resources/Images/QSAKQQ.jpg")) {
|
||||
qWarning() << "Can not load QSAKQQ.jpg.";
|
||||
return;
|
||||
}
|
||||
@ -265,21 +258,17 @@ void xToolsMainWindow::onAboutActionTriggered()
|
||||
{
|
||||
QString year = xToolsInterface::buildDateTime("yyyy");
|
||||
QString info;
|
||||
info += centralWidget()->windowTitle() + tr("(Part of Qt Swiss Army knife)");
|
||||
info += "\n";
|
||||
info += tr("Author: ") + SAK_AUTHOR;
|
||||
info += "\n";
|
||||
info += tr("Email: ") + SAK_AUTHOR_EMAIL;
|
||||
info += "\n";
|
||||
#ifdef SAK_GIT_COMMIT
|
||||
info += tr("Commit: ") + SAK_GIT_COMMIT;
|
||||
info += windowTitle() + tr("(A Part of xTools Project)");
|
||||
info += "\n\n";
|
||||
#ifdef X_TOOLS_GIT_COMMIT
|
||||
info += tr("Commit: ") + X_TOOLS_GIT_COMMIT;
|
||||
info += "\n\n";
|
||||
#endif
|
||||
info += "\n";
|
||||
#ifdef SAK_GIT_COMMIT_TIME
|
||||
info += tr("Date: ") + SAK_GIT_COMMIT_TIME;
|
||||
#ifdef X_TOOLS_GIT_COMMIT_TIME
|
||||
info += tr("Date: ") + X_TOOLS_GIT_COMMIT_TIME;
|
||||
info += "\n\n";
|
||||
#endif
|
||||
info += "\n";
|
||||
info += tr("Copyright 2018-%1 x-tools-author(x-tools@outlook.com). All rights reserved.").arg(year);
|
||||
info += tr("© 2018-%1 x-tools-author(x-tools@outlook.com). All rights reserved.").arg(year);
|
||||
QMessageBox::about(this, tr("About"), info);
|
||||
}
|
||||
|
||||
@ -311,6 +300,36 @@ void xToolsMainWindow::createQtConf()
|
||||
}
|
||||
}
|
||||
|
||||
void xToolsMainWindow::showQqQrCode()
|
||||
{
|
||||
QDialog dialog;
|
||||
dialog.setWindowTitle(tr("QR Code"));
|
||||
|
||||
struct QrCodeInfo
|
||||
{
|
||||
QString title;
|
||||
QString qrCode;
|
||||
};
|
||||
QList<QrCodeInfo> qrCodeInfoList;
|
||||
|
||||
qrCodeInfoList << QrCodeInfo{tr("User QQ Group"), QString(":/Resources/Images/UserQQ.jpg")}
|
||||
<< QrCodeInfo{tr("Qt QQ Group"), QString(":/Resources/Images/QtQQ.jpg")};
|
||||
|
||||
QTabWidget* tabWidget = new QTabWidget(&dialog);
|
||||
for (auto& var : qrCodeInfoList) {
|
||||
QLabel* label = new QLabel(tabWidget);
|
||||
label->setPixmap(QPixmap::fromImage(QImage(var.qrCode)));
|
||||
tabWidget->addTab(label, var.title);
|
||||
}
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout(&dialog);
|
||||
layout->addWidget(tabWidget);
|
||||
dialog.setLayout(layout);
|
||||
dialog.setModal(true);
|
||||
dialog.show();
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
QString xToolsMainWindow::getQtConfFileName()
|
||||
{
|
||||
return qApp->applicationDirPath() + "/qt.conf";
|
||||
|
||||
@ -30,6 +30,12 @@ protected:
|
||||
|
||||
QAction* m_exitAction;
|
||||
|
||||
QAction* m_gitHubAction;
|
||||
QAction* m_giteeAction;
|
||||
QAction* m_qqGroupAction;
|
||||
QAction* m_aboutAction;
|
||||
QAction* m_aboutQtAction;
|
||||
|
||||
private:
|
||||
QActionGroup* m_appStyleActionGroup;
|
||||
QActionGroup* m_languageActionGroup;
|
||||
@ -54,5 +60,6 @@ private:
|
||||
|
||||
void tryToReboot();
|
||||
void createQtConf();
|
||||
void showQqQrCode();
|
||||
QString getQtConfFileName();
|
||||
};
|
||||
|
||||
@ -5,5 +5,9 @@
|
||||
<file>Resources/Translations/xToolsCommon_zh_CN.qm</file>
|
||||
<file>Resources/Palettes/DarkPalette</file>
|
||||
<file>Resources/Palettes/LightPalette</file>
|
||||
<file>Resources/Icons/Gitee.svg</file>
|
||||
<file>Resources/Icons/GitHub.svg</file>
|
||||
<file>Resources/Images/QtQQ.jpg</file>
|
||||
<file>Resources/Images/UserQQ.jpg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@ -523,15 +523,22 @@ void MainWindow::initLanguageMenu()
|
||||
|
||||
void MainWindow::initHelpMenu()
|
||||
{
|
||||
QAction* aboutQtAction = new QAction(tr("About Qt"), this);
|
||||
m_helpMenu->addAction(aboutQtAction);
|
||||
connect(aboutQtAction, &QAction::triggered, this, [=]() {
|
||||
QMessageBox::aboutQt(this, tr("About Qt"));
|
||||
});
|
||||
|
||||
m_helpMenu->addSeparator();
|
||||
m_helpMenu->addAction(QIcon(":/Resources/Icons/GitHub.svg"),
|
||||
tr("Get Sources from Github"),
|
||||
this,
|
||||
[]() { QDesktopServices::openUrl(QUrl(X_TOOLS_GITHUB_REPOSITORY_URL)); });
|
||||
m_helpMenu->addAction(QIcon(":/Resources/Icons/Gitee.svg"),
|
||||
tr("Get Sources from Gitee"),
|
||||
this,
|
||||
[]() { QDesktopServices::openUrl(QUrl(X_TOOLS_GITEE_REPOSITORY_URL)); });
|
||||
m_helpMenu->addSeparator();
|
||||
#if 0
|
||||
QAction* aboutAction = new QAction(tr("About xTools"), this);
|
||||
m_helpMenu->addAction(aboutAction);
|
||||
connect(aboutAction, &QAction::triggered, this, &MainWindow::aboutSoftware);
|
||||
#endif
|
||||
#ifndef X_TOOLS_BUILD_FOR_STORE
|
||||
#ifdef Q_OS_WIN
|
||||
QString tips = tr("Buy from Microsoft App Store");
|
||||
QIcon buy(":/Resources/Icons/IconBuy.svg");
|
||||
@ -542,36 +549,16 @@ void MainWindow::initHelpMenu()
|
||||
QDesktopServices::openUrl(url);
|
||||
});
|
||||
#endif
|
||||
QMenu* srcMenu = new QMenu(tr("Get Source"), this);
|
||||
m_helpMenu->addMenu(srcMenu);
|
||||
QAction* visitGitHubAction = new QAction(QIcon(":/resources/images/GitHub.png"),
|
||||
tr("GitHub"),
|
||||
this);
|
||||
connect(visitGitHubAction, &QAction::triggered, []() {
|
||||
QUrl url = QUrl(QLatin1String(SAK_GITHUB_REPOSITORY_URL));
|
||||
QDesktopServices::openUrl(url);
|
||||
});
|
||||
srcMenu->addAction(visitGitHubAction);
|
||||
QAction* visitGiteeAction = new QAction(QIcon(":/resources/images/Gitee.png"),
|
||||
tr("Gitee"),
|
||||
this);
|
||||
connect(visitGiteeAction, &QAction::triggered, []() {
|
||||
QUrl url = QUrl(QLatin1String(SAK_GITEE_REPOSITORY_URL));
|
||||
QDesktopServices::openUrl(url);
|
||||
});
|
||||
srcMenu->addAction(visitGiteeAction);
|
||||
|
||||
#endif
|
||||
m_helpMenu->addSeparator();
|
||||
QAction* releaseHistoryAction = new QAction(tr("Release History"), this);
|
||||
m_helpMenu->addAction(releaseHistoryAction);
|
||||
connect(releaseHistoryAction, &QAction::triggered, this, &MainWindow::showHistory);
|
||||
|
||||
m_helpMenu->addSeparator();
|
||||
QAction* qrCodeAction = new QAction(tr("QR Code"), this);
|
||||
m_helpMenu->addAction(qrCodeAction);
|
||||
connect(qrCodeAction, &QAction::triggered, this, &MainWindow::showQrCode);
|
||||
#ifndef X_TOOLS_IMPORT_MODULE_PRIVATE
|
||||
m_helpMenu->addAction(tr("Donate"), this, &MainWindow::showDonation);
|
||||
#endif
|
||||
m_helpMenu->addAction(QIcon(":/Resources/Icons/GitHub.svg"),
|
||||
tr("Join in QQ Group"),
|
||||
this,
|
||||
&MainWindow::showQrCode);
|
||||
}
|
||||
|
||||
void MainWindow::initLinksMenu()
|
||||
@ -595,11 +582,11 @@ void MainWindow::initLinksMenu()
|
||||
<< Link{tr("Qt Official Release"),
|
||||
QString("https://wiki.qt.io/Qt_5.15_Release"),
|
||||
QString(":/resources/images/Qt.png")}
|
||||
<< Link{tr("Download SAK from Github"),
|
||||
QString("%1/releases").arg(SAK_GITHUB_REPOSITORY_URL),
|
||||
<< Link{tr("Download xTools from Github"),
|
||||
QString("%1/releases").arg(X_TOOLS_GITHUB_REPOSITORY_URL),
|
||||
QString(":/resources/images/GitHub.png")}
|
||||
<< Link{tr("Download SAK from Gitee"),
|
||||
QString("%1/releases").arg(SAK_GITEE_REPOSITORY_URL),
|
||||
<< Link{tr("Download xTools from Gitee"),
|
||||
QString("%1/releases").arg(X_TOOLS_GITEE_REPOSITORY_URL),
|
||||
QString(":/Resources/Icons/IconQQ.svg")}
|
||||
<< Link{tr("Office Web Site"),
|
||||
QString("https://qsaker.gitee.io/qsak/"),
|
||||
@ -761,17 +748,17 @@ void MainWindow::aboutSoftware()
|
||||
#ifndef SAK_RELEASE_FOR_APP_STORE
|
||||
<< Info{tr("Edition"), SAK_EDITION, false}
|
||||
#endif
|
||||
<< Info{tr("Author"), QString(SAK_AUTHOR), false}
|
||||
<< Info{tr("Email"), QString(SAK_AUTHOR_EMAIL), false}
|
||||
<< Info{tr("Author"), QString(X_TOOLS_AUTHOR), false}
|
||||
<< Info{tr("Email"), QString(X_TOOLS_AUTHOR_EMAIL), false}
|
||||
<< Info{tr("QQ"), QString("QQ:2869470394"), false}
|
||||
<< Info{tr("QQ Group"), QString("QQ:952218522"), false}
|
||||
<< Info{tr("Build Time"), dateTimeString, false}
|
||||
#ifndef SAK_RELEASE_FOR_APP_STORE
|
||||
<< Info{tr("Gitee Url"),
|
||||
QString("<a href=%1>%1</a>").arg(SAK_GITEE_REPOSITORY_URL),
|
||||
QString("<a href=%1>%1</a>").arg(X_TOOLS_GITEE_REPOSITORY_URL),
|
||||
true}
|
||||
<< Info{tr("Gitbub Url"),
|
||||
QString("<a href=%1>%1</a>").arg(SAK_GITHUB_REPOSITORY_URL),
|
||||
QString("<a href=%1>%1</a>").arg(X_TOOLS_GITHUB_REPOSITORY_URL),
|
||||
true}
|
||||
#endif
|
||||
<< Info{tr("Copyright"),
|
||||
@ -858,8 +845,8 @@ void MainWindow::showQrCode()
|
||||
};
|
||||
QList<QrCodeInfo> qrCodeInfoList;
|
||||
|
||||
qrCodeInfoList << QrCodeInfo{tr("User QQ Group"), QString(":/resources/images/QSAKQQ.jpg")}
|
||||
<< QrCodeInfo{tr("Qt QQ Group"), QString(":/resources/images/QtQQ.jpg")};
|
||||
qrCodeInfoList << QrCodeInfo{tr("User QQ Group"), QString(":/Resources/Images/QSAKQQ.jpg")}
|
||||
<< QrCodeInfo{tr("Qt QQ Group"), QString(":/Resources/Images/QtQQ.jpg")};
|
||||
|
||||
QTabWidget* tabWidget = new QTabWidget(&dialog);
|
||||
for (auto& var : qrCodeInfoList) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user