fix: 修复一些问题;移除有缺陷的组件;更新打包脚本;
This commit is contained in:
parent
606e55c057
commit
a55888b0eb
|
@ -235,8 +235,6 @@ set(CLASS_SRC
|
|||
src/class/languagemanager.cpp
|
||||
src/class/settingmanager.h
|
||||
src/class/settingmanager.cpp
|
||||
src/class/wingprogressdialog.h
|
||||
src/class/wingprogressdialog.cpp
|
||||
src/class/asdebugger.h
|
||||
src/class/asdebugger.cpp
|
||||
src/class/scriptconsolemachine.h
|
||||
|
@ -284,7 +282,9 @@ set(CLASS_SRC
|
|||
src/class/crashhandler.h
|
||||
src/class/crashhandler.cpp
|
||||
src/class/pluginsystem.h
|
||||
src/class/pluginsystem.cpp)
|
||||
src/class/pluginsystem.cpp
|
||||
src/class/inspectqtloghelper.h
|
||||
src/class/inspectqtloghelper.cpp)
|
||||
|
||||
set(INTERNAL_PLG_SRC
|
||||
src/class/wingangelapi.h src/class/wingangelapi.cpp
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -187,6 +187,8 @@ Homepage: https://www.cnblogs.com/wingsummer/
|
|||
os.mkdir(os.path.join(exeBasePath, "aslib"))
|
||||
|
||||
shutil.copy2(exemain_src, os.path.join(exeBasePath, package_name))
|
||||
shutil.copy2(os.path.join(projectdeb, "WingPlugin", "libWingPlugin.so"),
|
||||
os.path.join(exeBasePath, "libWingPlugin.so"))
|
||||
|
||||
desktopPath = os.path.join(exeDebPath, "usr", "share", "applications")
|
||||
os.makedirs(desktopPath)
|
||||
|
|
|
@ -13,6 +13,7 @@ import platform
|
|||
|
||||
from colorama import Fore, Style
|
||||
|
||||
|
||||
def run_command_interactive(command):
|
||||
"""
|
||||
Run a command interactively, printing its stdout in real-time.
|
||||
|
@ -37,6 +38,7 @@ def run_command_interactive(command):
|
|||
return_code = process.wait()
|
||||
return return_code
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="mkdeb.py", description="A deb installer maker for WingHexExplorer2")
|
||||
|
@ -125,13 +127,17 @@ def main():
|
|||
# check
|
||||
exemain_src = ""
|
||||
exesym_src = ""
|
||||
exeplg_src = ""
|
||||
|
||||
if (os.path.exists(os.path.join(projectdeb, "WingHexExplorer2.sln"))):
|
||||
exemain_src = os.path.join(projectdeb, "RelWithDebInfo", exe_name)
|
||||
exesym_src = os.path.join(projectdeb, "RelWithDebInfo", sym_name)
|
||||
exeplg_src = os.path.join(
|
||||
projectdeb, "WingPlugin", "RelWithDebInfo", "WingPlugin.dll")
|
||||
else:
|
||||
exemain_src = os.path.join(projectdeb, exe_name)
|
||||
exesym_src = os.path.join(projectdeb, sym_name)
|
||||
exeplg_src = os.path.join(projectdeb, "WingPlugin", "WingPlugin.dll")
|
||||
|
||||
if (os.path.exists(exemain_src) == False):
|
||||
print(
|
||||
|
@ -155,6 +161,8 @@ def main():
|
|||
|
||||
shutil.copy2(exemain_src, os.path.join(exeDebPath, exe_name))
|
||||
shutil.copy2(exesym_src, os.path.join(exeDebPath, sym_name))
|
||||
shutil.copy2(exeplg_src,
|
||||
os.path.join(exeDebPath, "WingPlugin.dll"))
|
||||
|
||||
shutil.copytree(os.path.join(buildinstaller, "share"),
|
||||
os.path.join(exeDebPath, "share"))
|
||||
|
@ -182,7 +190,8 @@ def main():
|
|||
subprocess.run([deploy_exec, os.path.join(exeDebPath, exe_name)], check=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(Fore.RED + f"[Error] deploy package error: \n{e.stderr.decode('utf-8')}" + Style.RESET_ALL)
|
||||
print(
|
||||
Fore.RED + f"[Error] deploy package error: \n{e.stderr.decode('utf-8')}" + Style.RESET_ALL)
|
||||
exit(-4)
|
||||
except FileNotFoundError:
|
||||
exit(-4)
|
||||
|
@ -243,8 +252,10 @@ Source: {#MyAppExePath}; DestDir: "{app}"; Flags: ignoreversion
|
|||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
"""
|
||||
iss_content += fr'Source: "{exeDebPath}\*"; ' + r'DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "*.iss,{#MyOutputBaseFilename}.exe,README.md"' + '\n'
|
||||
iss_content += fr'Source: "{exeDebPath}\README.md"; ' + r'DestDir: "{app}"; Flags: isreadme'
|
||||
iss_content += fr'Source: "{exeDebPath}\*"; ' + \
|
||||
r'DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "*.iss,{#MyOutputBaseFilename}.exe,README.md"' + '\n'
|
||||
iss_content += fr'Source: "{exeDebPath}\README.md"; ' + \
|
||||
r'DestDir: "{app}"; Flags: isreadme'
|
||||
|
||||
iss_content += """
|
||||
[Registry]
|
||||
|
|
|
@ -162,6 +162,9 @@ def main():
|
|||
shutil.copy2(os.path.join(installer_path, item),
|
||||
os.path.join(installer_path_exec, item))
|
||||
|
||||
shutil.copy2(os.path.join(build_path, "WingPlugin", "libWingPlugin.so"),
|
||||
os.path.join(installer_path_exec, "lib" , "libWingPlugin.so"))
|
||||
|
||||
# finally, copy other files
|
||||
print(Fore.GREEN + ">> Copying License and other materials..." + Style.RESET_ALL)
|
||||
|
||||
|
|
|
@ -117,6 +117,8 @@ def update(build_path):
|
|||
print(Fore.GREEN + ">> Installing..." + Style.RESET_ALL)
|
||||
|
||||
shutil.copy2(exemain_src, os.path.join(INSTALL_PATH, PACKAGE_NAME))
|
||||
shutil.copy2(os.path.join(build_path, "WingPlugin", "libWingPlugin.so"),
|
||||
os.path.join(INSTALL_PATH, "libWingPlugin.so"))
|
||||
|
||||
create_dir(os.path.join(INSTALL_PATH, "plugin"))
|
||||
create_dir(os.path.join(INSTALL_PATH, "scripts"))
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
<file>images/plugin.png</file>
|
||||
<file>images/pro.png</file>
|
||||
<file>images/qt.png</file>
|
||||
<file>images/qtloginspect.png</file>
|
||||
<file>images/readonly.png</file>
|
||||
<file>images/recent.png</file>
|
||||
<file>images/redo.png</file>
|
||||
|
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.5 MiB |
|
@ -29,6 +29,7 @@
|
|||
#include "define.h"
|
||||
#include "dialog/mainwindow.h"
|
||||
#include "dialog/splashdialog.h"
|
||||
#include "inspectqtloghelper.h"
|
||||
#include "languagemanager.h"
|
||||
#include "logger.h"
|
||||
#include "settingmanager.h"
|
||||
|
@ -42,6 +43,8 @@ AppManager::AppManager(int &argc, char *argv[])
|
|||
: QtSingleApplication(argc, argv) {
|
||||
ASSERT_SINGLETON;
|
||||
|
||||
LanguageManager::instance();
|
||||
InspectQtLogHelper::instance().init();
|
||||
CrashHandler::instance().init();
|
||||
|
||||
auto args = arguments();
|
||||
|
@ -77,7 +80,6 @@ AppManager::AppManager(int &argc, char *argv[])
|
|||
setFont(font);
|
||||
|
||||
SkinManager::instance();
|
||||
LanguageManager::instance();
|
||||
|
||||
auto dontSplash = set.dontUseSplash();
|
||||
|
||||
|
@ -123,6 +125,8 @@ AppManager::AppManager(int &argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
connect(_w, &MainWindow::closed, this,
|
||||
[]() { AppManager::instance()->exit(); });
|
||||
_instance = this;
|
||||
|
||||
if (splash)
|
||||
|
@ -130,6 +134,7 @@ AppManager::AppManager(int &argc, char *argv[])
|
|||
}
|
||||
|
||||
AppManager::~AppManager() {
|
||||
InspectQtLogHelper::instance().destory();
|
||||
ClangFormatManager::instance().save();
|
||||
CommandHistoryManager::save(QConsoleWidget::history().strings_);
|
||||
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
#include "inspectqtloghelper.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#define INFOLOG(msg) "<font color=\"green\">" + msg + "</font>"
|
||||
#define ERRLOG(msg) "<font color=\"red\">" + msg + "</font>"
|
||||
#define WARNLOG(msg) "<font color=\"gold\">" + msg + "</font>"
|
||||
|
||||
InspectQtLogHelper &InspectQtLogHelper::instance() {
|
||||
static InspectQtLogHelper ins;
|
||||
return ins;
|
||||
}
|
||||
|
||||
void InspectQtLogHelper::init() {
|
||||
_logger = new FramelessDialogBase;
|
||||
_ctx = new QTextBrowser(_logger);
|
||||
_ctx->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
_ctx->setUndoRedoEnabled(false);
|
||||
_ctx->setOpenExternalLinks(true);
|
||||
|
||||
auto menu = _ctx->createStandardContextMenu();
|
||||
auto ma = menu->actions();
|
||||
|
||||
menu->addSeparator();
|
||||
auto a = new QAction(tr("Clear"), menu);
|
||||
connect(a, &QAction::triggered, this, [this]() { _ctx->clear(); });
|
||||
menu->addAction(a);
|
||||
|
||||
auto af = ma.at(0);
|
||||
af = menu->insertSeparator(af);
|
||||
a = new QAction(tr("TopMost"), menu);
|
||||
a->setCheckable(true);
|
||||
connect(a, &QAction::toggled, this, [this](bool b) {
|
||||
_logger->setWindowFlag(Qt::WindowStaysOnTopHint, b);
|
||||
if (!_logger->isVisible()) {
|
||||
_logger->setVisible(true);
|
||||
}
|
||||
});
|
||||
menu->insertAction(af, a);
|
||||
|
||||
connect(_ctx, &QTextBrowser::customContextMenuRequested, this,
|
||||
[menu, this](const QPoint &pos) {
|
||||
menu->popup(_ctx->mapToGlobal(pos));
|
||||
});
|
||||
|
||||
_logger->buildUpContent(_ctx);
|
||||
_logger->setWindowTitle(tr("Inspect"));
|
||||
_logger->setWindowIcon(ICONRES("qtloginspect"));
|
||||
|
||||
qSetMessagePattern(QStringLiteral("%{if-debug}[Debug]%{endif}"
|
||||
"%{if-warning}[Warn]%{endif}"
|
||||
"%{if-info}[Info]%{endif}"
|
||||
"%{if-critical}[Error]%{endif}"
|
||||
"%{if-fatal}[Fatal]%{endif}"
|
||||
" %{message}"));
|
||||
qInstallMessageHandler(messageHandler);
|
||||
}
|
||||
|
||||
void InspectQtLogHelper::destory() {
|
||||
qInstallMessageHandler(nullptr);
|
||||
delete _logger;
|
||||
}
|
||||
|
||||
void InspectQtLogHelper::showLogWidget() { _logger->show(); }
|
||||
|
||||
InspectQtLogHelper::InspectQtLogHelper() {}
|
||||
|
||||
InspectQtLogHelper::~InspectQtLogHelper() {}
|
||||
|
||||
void InspectQtLogHelper::messageHandler(QtMsgType type,
|
||||
const QMessageLogContext &context,
|
||||
const QString &message) {
|
||||
auto logger = InspectQtLogHelper::instance()._ctx;
|
||||
auto msg = qFormatLogMessage(type, context, message);
|
||||
Q_ASSERT(logger);
|
||||
switch (type) {
|
||||
case QtDebugMsg:
|
||||
logger->append(msg);
|
||||
std::cout << qUtf8Printable(msg) << std::endl;
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
logger->append(INFOLOG(msg));
|
||||
std::cout << qUtf8Printable(msg) << std::endl;
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
case QtFatalMsg:
|
||||
logger->append(ERRLOG(msg));
|
||||
std::cerr << qUtf8Printable(msg) << std::endl;
|
||||
break;
|
||||
case QtInfoMsg:
|
||||
logger->append(INFOLOG(msg));
|
||||
std::cout << qUtf8Printable(msg) << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef INSPECTQTLOGHELPER_H
|
||||
#define INSPECTQTLOGHELPER_H
|
||||
|
||||
#include "dialog/framelessdialogbase.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QTextBrowser>
|
||||
|
||||
class InspectQtLogHelper : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static InspectQtLogHelper &instance();
|
||||
|
||||
void init();
|
||||
void destory();
|
||||
|
||||
void showLogWidget();
|
||||
|
||||
private:
|
||||
InspectQtLogHelper();
|
||||
~InspectQtLogHelper();
|
||||
Q_DISABLE_COPY_MOVE(InspectQtLogHelper)
|
||||
|
||||
private:
|
||||
static void messageHandler(QtMsgType type,
|
||||
const QMessageLogContext &context,
|
||||
const QString &message);
|
||||
|
||||
private:
|
||||
FramelessDialogBase *_logger;
|
||||
QTextBrowser *_ctx;
|
||||
};
|
||||
|
||||
#endif // INSPECTQTLOGHELPER_H
|
|
@ -1,124 +0,0 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify it under
|
||||
** the terms of the GNU Affero General Public License as published by the Free
|
||||
** Software Foundation, version 3.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
** details.
|
||||
**
|
||||
** You should have received a copy of the GNU Affero General Public License
|
||||
** along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "wingprogressdialog.h"
|
||||
|
||||
#include <QProgressBar>
|
||||
|
||||
WingProgressDialog::WingProgressDialog(QWidget *parent) {
|
||||
m_dialog = new QProgressDialog(parent, Qt::Widget);
|
||||
auto pb = new QProgressBar(this);
|
||||
pb->setTextVisible(false);
|
||||
m_dialog->setBar(pb);
|
||||
|
||||
buildUpContent(m_dialog);
|
||||
connect(m_dialog, &QProgressDialog::canceled, this,
|
||||
&WingProgressDialog::canceled);
|
||||
connect(m_dialog, &QProgressDialog::finished, this,
|
||||
&FramelessDialogBase::done);
|
||||
}
|
||||
|
||||
WingProgressDialog::WingProgressDialog(const QString &labelText,
|
||||
const QString &cancelButtonText,
|
||||
int minimum, int maximum,
|
||||
QWidget *parent) {
|
||||
m_dialog = new QProgressDialog(labelText, cancelButtonText, minimum,
|
||||
maximum, this);
|
||||
m_dialog->setWindowFlag(Qt::Widget);
|
||||
auto pb = new QProgressBar(this);
|
||||
pb->setTextVisible(false);
|
||||
m_dialog->setBar(pb);
|
||||
|
||||
buildUpContent(m_dialog);
|
||||
|
||||
connect(m_dialog, &QProgressDialog::canceled, this,
|
||||
&WingProgressDialog::cancel);
|
||||
connect(m_dialog, &QProgressDialog::finished, this,
|
||||
&FramelessDialogBase::done);
|
||||
}
|
||||
|
||||
WingProgressDialog::~WingProgressDialog() {}
|
||||
|
||||
void WingProgressDialog::setLabel(QLabel *label) { m_dialog->setLabel(label); }
|
||||
|
||||
void WingProgressDialog::setCancelButton(QPushButton *button) {
|
||||
m_dialog->setCancelButton(button);
|
||||
}
|
||||
|
||||
void WingProgressDialog::setBar(QProgressBar *bar) { m_dialog->setBar(bar); }
|
||||
|
||||
bool WingProgressDialog::wasCanceled() const { return m_dialog->wasCanceled(); }
|
||||
|
||||
int WingProgressDialog::minimum() const { return m_dialog->minimum(); }
|
||||
|
||||
int WingProgressDialog::maximum() const { return m_dialog->maximum(); }
|
||||
|
||||
int WingProgressDialog::value() const { return m_dialog->value(); }
|
||||
|
||||
QString WingProgressDialog::labelText() const { return m_dialog->labelText(); }
|
||||
|
||||
int WingProgressDialog::minimumDuration() const {
|
||||
return m_dialog->minimumDuration();
|
||||
}
|
||||
|
||||
void WingProgressDialog::setAutoReset(bool reset) {
|
||||
m_dialog->setAutoReset(reset);
|
||||
}
|
||||
|
||||
bool WingProgressDialog::autoReset() const { return m_dialog->autoReset(); }
|
||||
|
||||
void WingProgressDialog::setAutoClose(bool close) {
|
||||
m_dialog->setAutoClose(close);
|
||||
}
|
||||
|
||||
bool WingProgressDialog::autoClose() const { return m_dialog->autoClose(); }
|
||||
|
||||
void WingProgressDialog::open(QObject *receiver, const char *member) {
|
||||
m_dialog->open(receiver, member);
|
||||
}
|
||||
|
||||
void WingProgressDialog::cancel() { m_dialog->cancel(); }
|
||||
|
||||
void WingProgressDialog::reset() { m_dialog->reset(); }
|
||||
|
||||
void WingProgressDialog::setMaximum(int maximum) {
|
||||
m_dialog->setMaximum(maximum);
|
||||
}
|
||||
|
||||
void WingProgressDialog::setMinimum(int minimum) {
|
||||
m_dialog->setMinimum(minimum);
|
||||
}
|
||||
|
||||
void WingProgressDialog::setRange(int minimum, int maximum) {
|
||||
m_dialog->setRange(minimum, maximum);
|
||||
}
|
||||
|
||||
void WingProgressDialog::setValue(int progress) {
|
||||
m_dialog->setValue(progress);
|
||||
}
|
||||
|
||||
void WingProgressDialog::setLabelText(const QString &text) {
|
||||
m_dialog->setLabelText(text);
|
||||
}
|
||||
|
||||
void WingProgressDialog::setCancelButtonText(const QString &text) {
|
||||
m_dialog->setCancelButtonText(text);
|
||||
}
|
||||
|
||||
void WingProgressDialog::setMinimumDuration(int ms) {
|
||||
m_dialog->setMinimumDuration(ms);
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify it under
|
||||
** the terms of the GNU Affero General Public License as published by the Free
|
||||
** Software Foundation, version 3.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
** details.
|
||||
**
|
||||
** You should have received a copy of the GNU Affero General Public License
|
||||
** along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef WINGPROGRESSDIALOG_H
|
||||
#define WINGPROGRESSDIALOG_H
|
||||
|
||||
#include <QProgressDialog>
|
||||
|
||||
#include "dialog/framelessdialogbase.h"
|
||||
|
||||
class WingProgressDialog : public FramelessDialogBase {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WingProgressDialog(QWidget *parent = nullptr);
|
||||
|
||||
WingProgressDialog(const QString &labelText,
|
||||
const QString &cancelButtonText, int minimum,
|
||||
int maximum, QWidget *parent = nullptr);
|
||||
~WingProgressDialog();
|
||||
|
||||
public:
|
||||
void setLabel(QLabel *label);
|
||||
void setCancelButton(QPushButton *button);
|
||||
void setBar(QProgressBar *bar);
|
||||
|
||||
bool wasCanceled() const;
|
||||
|
||||
int minimum() const;
|
||||
int maximum() const;
|
||||
|
||||
int value() const;
|
||||
|
||||
QString labelText() const;
|
||||
int minimumDuration() const;
|
||||
|
||||
void setAutoReset(bool reset);
|
||||
bool autoReset() const;
|
||||
void setAutoClose(bool close);
|
||||
bool autoClose() const;
|
||||
|
||||
using FramelessDialogBase::open;
|
||||
|
||||
void open(QObject *receiver, const char *member);
|
||||
|
||||
public Q_SLOTS:
|
||||
void cancel();
|
||||
void reset();
|
||||
void setMaximum(int maximum);
|
||||
void setMinimum(int minimum);
|
||||
void setRange(int minimum, int maximum);
|
||||
void setValue(int progress);
|
||||
void setLabelText(const QString &text);
|
||||
void setCancelButtonText(const QString &text);
|
||||
void setMinimumDuration(int ms);
|
||||
|
||||
Q_SIGNALS:
|
||||
void canceled();
|
||||
|
||||
private:
|
||||
QProgressDialog *m_dialog;
|
||||
};
|
||||
|
||||
#endif // WINGPROGRESSDIALOG_H
|
|
@ -510,10 +510,12 @@ ErrFile EditorView::save(const QString &workSpaceName, const QString &path,
|
|||
|
||||
convertTabW(this);
|
||||
for (auto &c : m_cloneChildren) {
|
||||
if (c) {
|
||||
convertTabW(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (doc->isUndoByteModified() || m_fileName != fileName || isNewFile()) {
|
||||
if (m_docType == DocumentType::Extension) {
|
||||
|
|
|
@ -33,12 +33,6 @@ ColorPickerDialog::ColorPickerDialog(QWidget *parent)
|
|||
{240.0 / 360.0, Qt::blue},
|
||||
{300.0 / 360.0, Qt::magenta},
|
||||
{359.0 / 360.0, Qt::red}});
|
||||
ui->saturationSlider->setGradientStops(
|
||||
{{0.0 / 255.0, QColor::fromHsv(ui->hueSlider->value(), 0, 255)},
|
||||
{255.0 / 255.0, QColor::fromHsv(ui->hueSlider->value(), 255, 255)}});
|
||||
ui->brightnessSlider->setGradientStops(
|
||||
{{0.0 / 255.0, QColor::fromHsv(ui->hueSlider->value(), 255, 0)},
|
||||
{255.0 / 255.0, QColor::fromHsv(ui->hueSlider->value(), 255, 255)}});
|
||||
|
||||
_oldColor.setHsv(180, 255, 255);
|
||||
updateColor(_oldColor);
|
||||
|
@ -74,8 +68,23 @@ void ColorPickerDialog::updateColor() {
|
|||
updateColor(_color);
|
||||
}
|
||||
|
||||
void ColorPickerDialog::updateHueSlider() {
|
||||
ui->saturationSlider->setGradientStops(
|
||||
{{0.0 / 255.0, QColor::fromHsv(ui->hueSlider->value(), 0, 255)},
|
||||
{255.0 / 255.0, QColor::fromHsv(ui->hueSlider->value(), 255, 255)}});
|
||||
ui->brightnessSlider->setGradientStops(
|
||||
{{0.0 / 255.0, QColor::fromHsv(ui->hueSlider->value(), 255, 0)},
|
||||
{255.0 / 255.0, QColor::fromHsv(ui->hueSlider->value(), 255, 255)}});
|
||||
}
|
||||
|
||||
void ColorPickerDialog::updateColor(QColor color) {
|
||||
ui->hueSlider->setValue(color.hsvHue());
|
||||
ui->saturationSlider->setGradientStops(
|
||||
{{0.0 / 255.0, QColor::fromHsv(ui->hueSlider->value(), 0, 255)},
|
||||
{255.0 / 255.0, QColor::fromHsv(ui->hueSlider->value(), 255, 255)}});
|
||||
ui->brightnessSlider->setGradientStops(
|
||||
{{0.0 / 255.0, QColor::fromHsv(ui->hueSlider->value(), 255, 0)},
|
||||
{255.0 / 255.0, QColor::fromHsv(ui->hueSlider->value(), 255, 255)}});
|
||||
ui->saturationSlider->setValue(color.hsvSaturation());
|
||||
ui->brightnessSlider->setValue(color.value());
|
||||
ui->leColor->setText(color.name());
|
||||
|
|
|
@ -56,7 +56,7 @@ private slots:
|
|||
|
||||
private:
|
||||
void updateColor();
|
||||
|
||||
void updateHueSlider();
|
||||
void updateColor(QColor color);
|
||||
|
||||
private:
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "class/appmanager.h"
|
||||
#include "class/dockcomponentsfactory.h"
|
||||
#include "class/eventfilter.h"
|
||||
#include "class/inspectqtloghelper.h"
|
||||
#include "class/langservice.h"
|
||||
#include "class/languagemanager.h"
|
||||
#include "class/layoutmanager.h"
|
||||
|
@ -1674,6 +1675,8 @@ RibbonTabContent *MainWindow::buildViewPage(RibbonTabContent *tab) {
|
|||
&MainWindow::on_exportlog);
|
||||
addPannelAction(pannel, QStringLiteral("clearhis"), tr("ClearLog"),
|
||||
&MainWindow::on_clslog);
|
||||
addPannelAction(pannel, QStringLiteral("qtloginspect"), tr("InsepctQt"),
|
||||
&MainWindow::on_inspectQt);
|
||||
}
|
||||
|
||||
return tab;
|
||||
|
@ -2296,10 +2299,11 @@ void MainWindow::on_findfile() {
|
|||
info.encoding = r.encoding;
|
||||
info.str = r.str;
|
||||
|
||||
showStatus(tr("Finding..."));
|
||||
ExecAsync<EditorView::FindError>(
|
||||
[this, r]() -> EditorView::FindError {
|
||||
m_isfinding = true;
|
||||
this->showStatus(tr("Finding..."));
|
||||
|
||||
return currentEditor()->find(r);
|
||||
},
|
||||
[this](EditorView::FindError err) {
|
||||
|
@ -3040,6 +3044,10 @@ void MainWindow::on_clslog() {
|
|||
tr("ClearLogSuccess"));
|
||||
}
|
||||
|
||||
void MainWindow::on_inspectQt() {
|
||||
InspectQtLogHelper::instance().showLogWidget();
|
||||
}
|
||||
|
||||
void MainWindow::on_scriptwindow() {
|
||||
Q_ASSERT(m_scriptDialog);
|
||||
m_scriptDialog->show();
|
||||
|
@ -3081,6 +3089,7 @@ void MainWindow::on_wiki() {
|
|||
}
|
||||
|
||||
void MainWindow::on_update() {
|
||||
showStatus(tr("CheckingUpdate"));
|
||||
ExecAsync<int>(
|
||||
[]() -> int {
|
||||
bool ok = false;
|
||||
|
@ -3100,8 +3109,8 @@ void MainWindow::on_update() {
|
|||
WingMessageBox::information(this, qAppName(),
|
||||
tr("NewestVersion"));
|
||||
}
|
||||
},
|
||||
tr("CheckingUpdate"));
|
||||
this->showStatus({});
|
||||
});
|
||||
}
|
||||
|
||||
QString MainWindow::saveLog() {
|
||||
|
@ -3989,6 +3998,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
|||
PluginSystem::instance().destory();
|
||||
|
||||
FramelessMainWindow::closeEvent(event);
|
||||
emit closed();
|
||||
}
|
||||
|
||||
bool MainWindow::eventFilter(QObject *watched, QEvent *event) {
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "class/clickcallback.h"
|
||||
#include "class/recentfilemanager.h"
|
||||
#include "class/scriptmanager.h"
|
||||
#include "class/wingprogressdialog.h"
|
||||
#include "control/editorview.h"
|
||||
#include "control/qtableviewext.h"
|
||||
#include "control/scriptingconsole.h"
|
||||
|
@ -201,6 +200,7 @@ private slots:
|
|||
void on_saveLayout();
|
||||
void on_exportlog();
|
||||
void on_clslog();
|
||||
void on_inspectQt();
|
||||
|
||||
void on_scriptwindow();
|
||||
void on_setting_general();
|
||||
|
@ -438,8 +438,7 @@ private:
|
|||
|
||||
/* =============== some templates for async execution ===============*/
|
||||
template <typename ReturnType, typename ExecFunc, typename FinishFunc>
|
||||
void ExecAsync(ExecFunc &&execFunc, FinishFunc &&finishFunc,
|
||||
const QString &tip = QString()) {
|
||||
void ExecAsync(ExecFunc &&execFunc, FinishFunc &&finishFunc) {
|
||||
QFutureWatcher<ReturnType> *watcher = new QFutureWatcher<ReturnType>();
|
||||
|
||||
QObject::connect(watcher, &QFutureWatcher<ReturnType>::finished, this,
|
||||
|
@ -451,25 +450,10 @@ private:
|
|||
|
||||
auto fu = QtConcurrent::run([=]() -> ReturnType { return execFunc(); });
|
||||
watcher->setFuture(fu);
|
||||
|
||||
if (!tip.isEmpty()) {
|
||||
auto pdialog = new WingProgressDialog(tip, QString(), 0, 0);
|
||||
pdialog->setModal(true);
|
||||
pdialog->setValue(0);
|
||||
|
||||
QObject::connect(watcher, &QFutureWatcher<ReturnType>::finished,
|
||||
this, [pdialog]() mutable {
|
||||
pdialog->cancel();
|
||||
pdialog->deleteLater();
|
||||
});
|
||||
|
||||
pdialog->exec();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename ExecFunc, typename FinishFunc>
|
||||
void ExecAsync_VOID(ExecFunc &&execFunc, FinishFunc &&finishFunc,
|
||||
const QString &tip = QString()) {
|
||||
void ExecAsync_VOID(ExecFunc &&execFunc, FinishFunc &&finishFunc) {
|
||||
QFutureWatcher<void> *watcher = new QFutureWatcher<void>();
|
||||
|
||||
QObject::connect(watcher, &QFutureWatcher<void>::finished, this,
|
||||
|
@ -480,22 +464,11 @@ private:
|
|||
|
||||
auto fu = QtConcurrent::run([=]() -> void { return execFunc(); });
|
||||
watcher->setFuture(fu);
|
||||
|
||||
if (!tip.isEmpty()) {
|
||||
auto pdialog = new WingProgressDialog(tip, QString(), 0, 0);
|
||||
pdialog->setModal(true);
|
||||
pdialog->setValue(0);
|
||||
|
||||
QObject::connect(watcher, &QFutureWatcher<void>::finished, this,
|
||||
[pdialog]() mutable {
|
||||
pdialog->cancel();
|
||||
pdialog->deleteLater();
|
||||
});
|
||||
|
||||
pdialog->exec();
|
||||
}
|
||||
}
|
||||
|
||||
signals:
|
||||
void closed();
|
||||
|
||||
private:
|
||||
Ribbon *m_ribbon = nullptr;
|
||||
ads::CDockManager *m_dock = nullptr;
|
||||
|
|
Loading…
Reference in New Issue