Skip to content

Commit

Permalink
去掉 部分插件;
Browse files Browse the repository at this point in the history
  • Loading branch information
RealChuan committed Apr 18, 2024
1 parent 131e26d commit 1c14242
Show file tree
Hide file tree
Showing 94 changed files with 1,603 additions and 3,170 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ endif()

project(
Qt-App
VERSION 0.0.1
VERSION 0.1.1
LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
Expand Down
45 changes: 26 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,33 @@

## 代码结构

1. [3rdparty](3rdparty):第三方库;
1. [qtlockedfile](3rdparty/qtlockedfile):Qt文件锁;
2. [qtsingleapplication](3rdparty/qtsingleapplication):Qt单实例;
3. [breakpad](3rdparty/breakpad.hpp):基于Google Breakpad封装的崩溃捕捉;
2. [aggregate](aggregate):聚合;
3. [apps](apps):应用程序;
1. [app](apps/app):Qt-App;
2. [crashreport](apps/crashreport):CrashReport;
4. [cmake](cmake):封装的CMake实用函数;
1. [cmake](cmake):封装的CMake实用函数;
1. [utils](cmake/utils.cmake):实用函数;
5. [core](core):插件都继承于此;
6. [extensionsystem](extensionsystem):插件系统,代码来自于Qt-Creator,做了一些修改;
7. [gui](gui):封装的界面组件;
8. [plugins](plugins):插件;
1. [coreplugin](plugins/coreplugin):核心插件,主界面、菜单、工具栏、状态栏、设置、插件管理器等;
2. [hashplugin](plugins/hashplugin):哈希插件,QT提供的哈希算法;
3. [serialplugin](plugins/serialplugin):串口插件;
4. [tcpplugin](plugins/tcpplugin):TCP插件;
9. [resource](resource):图片和QSS文件;
10. [utils](utils):工具函数封装;
2. [doc](doc):文档说明和图片;
3. [examples](examples):示例代码;
4. [packaging](packaging):打包和发布;
5. [src](src):源码;
1. [3rdparty](src/3rdparty):第三方库;
1. [qtlockedfile](src/3rdparty/qtlockedfile):Qt文件锁;
2. [qtsingleapplication](src/3rdparty/qtsingleapplication):Qt单实例;
3. [breakpad](src/3rdparty/breakpad.hpp):基于Google Breakpad封装的崩溃捕捉;
2. [aggregate](src/aggregate):聚合;
3. [apps](src/apps):应用程序;
1. [app](src/apps/app):Qt-App;
2. [crashreport](src/apps/crashreport):CrashReport;
4. [core](src/core):插件都继承于此;
5. [extensionsystem](src/extensionsystem):插件系统,代码来自于Qt-Creator,做了一些修改;
6. [gui](src/gui):封装的界面组件;
7. [plugins](src/plugins):插件;
1. [aboutplugin](src/plugins/aboutplugin):关于插件;
2. [coreplugin](src/plugins/coreplugin):核心插件,主界面、菜单、工具栏、状态栏、设置、插件管理器等;
3. [guiplugin](src/plugins/guiplugin):GUI插件,一些基于QSS样式定制的GUI组件;
4. [hashplugin](src/plugins/hashplugin):哈希插件,QT提供的哈希算法;
5. [helloplugin](src/plugins/helloplugin):Hello插件,用于测试插件开发;
6. [systeminfoplugin](src/plugins/systeminfoplugin):系统信息插件;
8. [resource](resource):图片和QSS文件;
9. [utils](utils):工具函数封装;
6. [translations](translations):翻译文件;

## 问题和备注

Expand Down
4 changes: 2 additions & 2 deletions common.pri
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ defineReplace(replaceLibName) {
}

isEmpty(RC_LANG): RC_LANG = 0x0004
isEmpty(VERSION): VERSION = 0.0.0.1
isEmpty(VERSION): VERSION = 0.1.1.0
CONFIG += skip_target_version_ext

isEmpty(QMAKE_TARGET_COMPANY): QMAKE_TARGET_COMPANY = The Youth.
isEmpty(QMAKE_TARGET_DESCRIPTION): QMAKE_TARGET_DESCRIPTION = Qt-App
isEmpty(QMAKE_TARGET_COPYRIGHT): QMAKE_TARGET_COPYRIGHT = Copyright (C) 2023 Youth.
isEmpty(QMAKE_TARGET_COPYRIGHT): QMAKE_TARGET_COPYRIGHT = Copyright (C) 2017-2024 Youth.
isEmpty(QMAKE_TARGET_PRODUCT): QMAKE_TARGET_PRODUCT = Qt-App
isEmpty(QMAKE_TARGET_ORIGINAL_FILENAME): QMAKE_TARGET_ORIGINAL_FILENAME = Qt-App
isEmpty(QMAKE_TARGET_INTERNALNAME): QMAKE_TARGET_INTERNALNAME = Qt-App
Expand Down
Binary file modified doc/Qt-App.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/3rdparty/breakpad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace Utils {

QString getCrashPath()
auto getCrashPath() -> QString
{
const QString path = Utils::getConfigPath() + "/crashes";
Utils::generateDirectorys(path);
Expand Down Expand Up @@ -52,12 +52,12 @@ void createEnvironment()

// 程序崩溃回调函数;
#if defined(Q_OS_WIN)
bool callback(const wchar_t *dump_path,
auto callback(const wchar_t *dump_path,
const wchar_t *id,
void *,
EXCEPTION_POINTERS *,
MDRawAssertionInfo *,
bool succeeded)
bool succeeded) -> bool
{
if (succeeded) {
qInfo() << "Create dump file success:" << QString::fromWCharArray(dump_path)
Expand Down Expand Up @@ -126,7 +126,7 @@ struct BreakPad::BreakPadPrivate
QScopedPointer<google_breakpad::ExceptionHandler> exceptionHandlerPtr;
};

BreakPad *BreakPad::instance()
auto BreakPad::instance() -> BreakPad *
{
static BreakPad breakPad;
return &breakPad;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ elseif(CMAKE_HOST_APPLE)
MACOSX_BUNDLE_EXECUTABLE_NAME "${PROJECT_NAME}"
MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}"
MACOSX_BUNDLE_COPYRIGHT "(C) 2023 Youth"
MACOSX_BUNDLE_COPYRIGHT "(C) 2024 Youth"
MACOSX_BUNDLE_GUI_IDENTIFIER "com.Youth.${PROJECT_NAME}"
MACOSX_BUNDLE_ICON_FILE app.icns
MACOSX_BUNDLE_INFO_STRING "APPL???")
Expand Down
10 changes: 5 additions & 5 deletions src/apps/app/app.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
IDI_ICON1 ICON "app.ico"

VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,0,0,1
PRODUCTVERSION 0,0,0,1
FILEVERSION 0,1,1,0
PRODUCTVERSION 0,1,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
Expand All @@ -21,11 +21,11 @@ VS_VERSION_INFO VERSIONINFO
BEGIN
VALUE "CompanyName", "The Youth.\0"
VALUE "FileDescription", "Qt-App\0"
VALUE "FileVersion", "0.0.0.1\0"
VALUE "LegalCopyright", "Copyright (C) 2023 Youth.\0"
VALUE "FileVersion", "0.1.1.0\0"
VALUE "LegalCopyright", "Copyright (C) 2017-2024 Youth.\0"
VALUE "OriginalFilename", "Qt-App\0"
VALUE "ProductName", "Qt-App\0"
VALUE "ProductVersion", "0.0.0.1\0"
VALUE "ProductVersion", "0.1.1.0\0"
VALUE "InternalName", "Qt-App\0"
VALUE "Comments", "Qt-App\0"
VALUE "LegalTrademarks", "Youth\0"
Expand Down
23 changes: 10 additions & 13 deletions src/apps/app/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
#include <extensionsystem/pluginspec.h>
#include <gui/waitwidget.h>
#include <resource/resource.hpp>
#include <utils/appinfo.hpp>
#include <utils/languageconfig.hpp>
#include <utils/logasync.h>
#include <utils/utils.h>

#include <QNetworkProxyFactory>
#include <QStyle>

#define AppName "Qt-App"

void initResource()
{
Resource r; // 这样才可以使用qrc
Expand All @@ -24,12 +23,12 @@ void initResource()

void setAppInfo()
{
qApp->setApplicationVersion("0.0.1");
qApp->setApplicationDisplayName(AppName);
qApp->setApplicationName(AppName);
qApp->setDesktopFileName(AppName);
qApp->setOrganizationDomain("Youth");
qApp->setOrganizationName("Youth");
qApp->setApplicationVersion(Utils::version.toString());
qApp->setApplicationDisplayName(Utils::appName);
qApp->setApplicationName(Utils::appName);
qApp->setDesktopFileName(Utils::appName);
qApp->setOrganizationDomain(Utils::organizationDomain);
qApp->setOrganizationName(Utils::organzationName);
qApp->setWindowIcon(QIcon(":/icon/icon/app.png"));
}

Expand All @@ -38,8 +37,7 @@ void setQss()
Utils::setQSS({":/qss/qss/common.css",
":/qss/qss/commonwidget.css",
":/qss/qss/sidebarbutton.css",
":/qss/qss/carshdialog.css",
":/qss/qss/corewidget.css"});
":/qss/qss/specific.css"});
}

auto main(int argc, char *argv[]) -> int
Expand All @@ -53,7 +51,7 @@ auto main(int argc, char *argv[]) -> int
#endif
Utils::setHighDpiEnvironmentVariable();
SharedTools::QtSingleApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
SharedTools::QtSingleApplication app(AppName, argc, argv);
SharedTools::QtSingleApplication app(Utils::appName, argc, argv);
if (app.isRunning()) {
qWarning() << "This is already running";
if (app.sendMessage("raise_window_noop", 5000)) {
Expand Down Expand Up @@ -88,8 +86,7 @@ auto main(int argc, char *argv[]) -> int
log->startWork();

initResource();
Utils::printBuildInfo();
//Utils::setUTF8Code();
qInfo().noquote() << "\n\n" + Utils::systemInfo() + "\n\n";
Utils::setGlobalThreadPoolMaxSize();
Utils::loadFonts(app.applicationDirPath() + "/fonts");
setQss();
Expand Down
10 changes: 5 additions & 5 deletions src/apps/crashreport/app.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
IDI_ICON1 ICON "app.ico"

VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,0,0,1
PRODUCTVERSION 0,0,0,1
FILEVERSION 0,1,1,0
PRODUCTVERSION 0,1,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
Expand All @@ -21,11 +21,11 @@ VS_VERSION_INFO VERSIONINFO
BEGIN
VALUE "CompanyName", "The Youth.\0"
VALUE "FileDescription", "Qt-App\0"
VALUE "FileVersion", "0.0.0.1\0"
VALUE "LegalCopyright", "Copyright (C) 2023 Youth.\0"
VALUE "FileVersion", "0.1.1.0\0"
VALUE "LegalCopyright", "Copyright (C) 2024 Youth.\0"
VALUE "OriginalFilename", "Qt-App\0"
VALUE "ProductName", "Qt-App\0"
VALUE "ProductVersion", "0.0.0.1\0"
VALUE "ProductVersion", "0.1.1.0\0"
VALUE "InternalName", "Qt-App\0"
VALUE "Comments", "Qt-App\0"
VALUE "LegalTrademarks", "Youth\0"
Expand Down
30 changes: 15 additions & 15 deletions src/apps/crashreport/crashwidgets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void openDir(const QString &path)
class CrashWidgets::CrashWidgetsPrivate
{
public:
CrashWidgetsPrivate(CrashWidgets *q)
explicit CrashWidgetsPrivate(CrashWidgets *q)
: q_ptr(q)
{
auto appArgs = qApp->arguments();
Expand All @@ -45,7 +45,7 @@ CrashWidgets::CrashWidgets(QWidget *parent)
resize(450, 450);
}

CrashWidgets::~CrashWidgets() {}
CrashWidgets::~CrashWidgets() = default;

void CrashWidgets::onOpenCrashPath()
{
Expand All @@ -58,24 +58,24 @@ void CrashWidgets::onRestart()
QProcess::startDetached(d_ptr->appPath, d_ptr->args);
}

void CrashWidgets::onQuit()
{
QMetaObject::invokeMethod(qApp, &QApplication::quit, Qt::QueuedConnection);
}

void CrashWidgets::setupUI()
{
auto crashButton = new QPushButton(tr("Path of Crash File"), this);
auto restartButton = new QPushButton(tr("Restart"), this);
auto closeButton = new QPushButton(tr("Close"), this);
auto *crashButton = new QPushButton(tr("Path of Crash File"), this);
auto *restartButton = new QPushButton(tr("Restart"), this);
auto *closeButton = new QPushButton(tr("Close"), this);
crashButton->setObjectName("BlueButton");
restartButton->setObjectName("BlueButton");
closeButton->setObjectName("BlueButton");
connect(crashButton, &QPushButton::clicked, this, &CrashWidgets::onOpenCrashPath);
connect(restartButton, &QPushButton::clicked, this, &CrashWidgets::onRestart);
connect(closeButton, &QPushButton::clicked, this, &CrashWidgets::onQuit);

auto crashLabel = new QLabel(this);
connect(
closeButton,
&QPushButton::clicked,
this,
[] { Utils::quitApplication(); },
Qt::QueuedConnection);

auto *crashLabel = new QLabel(this);
crashLabel->setObjectName("CrashLabel");
crashLabel->setWordWrap(true);
crashLabel->setAlignment(Qt::AlignCenter);
Expand All @@ -87,8 +87,8 @@ void CrashWidgets::setupUI()
"Contact Me - Email: \n"
"[email protected]"));

auto widget = new QWidget(this);
auto layout = new QVBoxLayout(widget);
auto *widget = new QWidget(this);
auto *layout = new QVBoxLayout(widget);
layout->addStretch();
layout->addWidget(crashLabel);
layout->addStretch();
Expand Down
1 change: 0 additions & 1 deletion src/apps/crashreport/crashwidgets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class CrashWidgets : public GUI::CommonWidget
private slots:
void onOpenCrashPath();
void onRestart();
void onQuit();

private:
void setupUI();
Expand Down
26 changes: 13 additions & 13 deletions src/apps/crashreport/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
#include <3rdparty/breakpad.hpp>
#include <3rdparty/qtsingleapplication/qtsingleapplication.h>
#include <resource/resource.hpp>
#include <utils/appinfo.hpp>
#include <utils/languageconfig.hpp>
#include <utils/logasync.h>
#include <utils/utils.h>

#include <QNetworkProxyFactory>
#include <QStyle>

#define AppName "CrashReport"

void initResource()
{
Resource r; // 这样才可以使用qrc
Expand All @@ -22,19 +21,21 @@ void initResource()

void setAppInfo()
{
qApp->setApplicationVersion("0.0.1");
qApp->setApplicationDisplayName(AppName);
qApp->setApplicationName(AppName);
qApp->setDesktopFileName(AppName);
qApp->setOrganizationDomain("Youth");
qApp->setOrganizationName("Youth");
qApp->setApplicationVersion(Utils::version.toString());
qApp->setApplicationDisplayName(Utils::crashName);
qApp->setApplicationName(Utils::crashName);
qApp->setDesktopFileName(Utils::crashName);
qApp->setOrganizationDomain(Utils::organizationDomain);
qApp->setOrganizationName(Utils::organzationName);
qApp->setWindowIcon(QIcon(":/icon/icon/crash.png"));
}

void setQss()
{
Utils::setQSS(
{":/qss/qss/common.css", ":/qss/qss/commonwidget.css", ":/qss/qss/carshdialog.css"});
Utils::setQSS({":/qss/qss/common.css",
":/qss/qss/commonwidget.css",
":/qss/qss/sidebarbutton.css",
":/qss/qss/specific.css"});
}

auto main(int argc, char *argv[]) -> int
Expand All @@ -48,7 +49,7 @@ auto main(int argc, char *argv[]) -> int
#endif
Utils::setHighDpiEnvironmentVariable();
SharedTools::QtSingleApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
SharedTools::QtSingleApplication app(AppName, argc, argv);
SharedTools::QtSingleApplication app(Utils::crashName, argc, argv);
if (app.isRunning()) {
qWarning() << "This is already running";
if (app.sendMessage("raise_window_noop", 5000)) {
Expand Down Expand Up @@ -79,8 +80,7 @@ auto main(int argc, char *argv[]) -> int
log->startWork();

initResource();
Utils::printBuildInfo();
//Utils::setUTF8Code();
qInfo().noquote() << "\n\n" + Utils::systemInfo() + "\n\n";
Utils::setGlobalThreadPoolMaxSize();
Utils::loadFonts(app.applicationDirPath() + "/fonts");
setQss();
Expand Down
2 changes: 1 addition & 1 deletion src/core/corewidget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CORE_EXPORT CoreWidget : public QObject
{
Q_OBJECT
public:
enum Type { Tool, About };
enum Type { Main, Help };

explicit CoreWidget(QObject *parent = nullptr);
~CoreWidget() override;
Expand Down
Loading

0 comments on commit 1c14242

Please sign in to comment.