feat: 更新上游组件;用户友好优化;
This commit is contained in:
parent
23e968cdd4
commit
ac4bd1bef2
|
@ -25,6 +25,7 @@ jobs:
|
|||
host: 'windows'
|
||||
target: 'desktop'
|
||||
arch: 'win64_msvc2019_64'
|
||||
modules: 'qtactiveqt'
|
||||
cache: true
|
||||
- name: Add Chinese support file for InnoSetup
|
||||
run: |
|
||||
|
|
|
@ -39,6 +39,7 @@ jobs:
|
|||
host: ${{ matrix.os == 'windows-latest' && 'windows' || 'linux' }}
|
||||
target: 'desktop'
|
||||
arch: ${{ matrix.arch }}
|
||||
modules: ${{ matrix.os == 'windows-latest' && matrix.qt_version == '6.6.2' && 'qtactiveqt' || '' }}
|
||||
cache: true
|
||||
|
||||
- name: Configure CMake
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 147afda646faa0a8b10309dd2716b961bcb54051
|
||||
Subproject commit f9becd7ca224f32bc8d86ca09d697e2455a9d97e
|
|
@ -1 +1 @@
|
|||
Subproject commit 60c48755e3f717eace7830d7bbc0d8f1a5e0cc8a
|
||||
Subproject commit 606b6347edf0758c531abb6c36743e09a4c48a84
|
|
@ -38,6 +38,8 @@ option(WINGHEX_USE_FRAMELESS "Use borderless windows to ensure UI uniformity"
|
|||
TRUE)
|
||||
|
||||
if(WIN32)
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED AxContainer)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED AxContainer)
|
||||
add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
|
@ -193,7 +195,9 @@ set(CONTROL_SRC
|
|||
src/control/asobjtreewidget.h
|
||||
src/control/asobjtreewidget.cpp
|
||||
src/control/qtlonglongspinbox.cpp
|
||||
src/control/qtlonglongspinbox.h)
|
||||
src/control/qtlonglongspinbox.h
|
||||
src/control/dockwidgettab.h
|
||||
src/control/dockwidgettab.cpp)
|
||||
|
||||
set(CLASS_SRC
|
||||
src/class/logger.cpp
|
||||
|
@ -259,7 +263,11 @@ set(CLASS_SRC
|
|||
src/class/wingupdater.h
|
||||
src/class/wingupdater.cpp
|
||||
src/class/richtextitemdelegate.h
|
||||
src/class/richtextitemdelegate.cpp)
|
||||
src/class/richtextitemdelegate.cpp
|
||||
src/class/showinshell.h
|
||||
src/class/showinshell.cpp
|
||||
src/class/dockcomponentsfactory.h
|
||||
src/class/dockcomponentsfactory.cpp)
|
||||
|
||||
set(INTERNAL_PLG_SRC
|
||||
src/class/wingangelapi.h src/class/wingangelapi.cpp
|
||||
|
@ -490,42 +498,30 @@ else()
|
|||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
${CMAKE_PROJECT_NAME}
|
||||
PRIVATE Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
Qt${QT_VERSION_MAJOR}::Concurrent
|
||||
Qt${QT_VERSION_MAJOR}::PrintSupport
|
||||
Qt${QT_VERSION_MAJOR}::GuiPrivate
|
||||
Qt${QT_VERSION_MAJOR}::CorePrivate
|
||||
Qt${QT_VERSION_MAJOR}::Xml
|
||||
QtSingleApplication::QtSingleApplication
|
||||
QHexView
|
||||
QCodeEditor2
|
||||
QJsonModel
|
||||
angelscript
|
||||
nlohmann_json::nlohmann_json
|
||||
qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
|
||||
if(WINGHEX_USE_FRAMELESS)
|
||||
target_link_libraries(
|
||||
${CMAKE_PROJECT_NAME}
|
||||
PRIVATE Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
Qt${QT_VERSION_MAJOR}::Concurrent
|
||||
Qt${QT_VERSION_MAJOR}::PrintSupport
|
||||
Qt${QT_VERSION_MAJOR}::GuiPrivate
|
||||
Qt${QT_VERSION_MAJOR}::CorePrivate
|
||||
Qt${QT_VERSION_MAJOR}::Xml
|
||||
QtSingleApplication::QtSingleApplication
|
||||
QWKCore
|
||||
QWKWidgets
|
||||
QHexView
|
||||
QCodeEditor2
|
||||
QJsonModel
|
||||
angelscript
|
||||
nlohmann_json::nlohmann_json
|
||||
qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
else()
|
||||
target_link_libraries(
|
||||
${CMAKE_PROJECT_NAME}
|
||||
PRIVATE Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
Qt${QT_VERSION_MAJOR}::Concurrent
|
||||
Qt${QT_VERSION_MAJOR}::PrintSupport
|
||||
Qt${QT_VERSION_MAJOR}::GuiPrivate
|
||||
Qt${QT_VERSION_MAJOR}::CorePrivate
|
||||
Qt${QT_VERSION_MAJOR}::Xml
|
||||
QtSingleApplication::QtSingleApplication
|
||||
QHexView
|
||||
QCodeEditor2
|
||||
QJsonModel
|
||||
angelscript
|
||||
nlohmann_json::nlohmann_json
|
||||
qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE QWKCore QWKWidgets)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME}
|
||||
PRIVATE Qt${QT_VERSION_MAJOR}::AxContainer)
|
||||
endif()
|
||||
|
||||
target_include_directories(
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -98,6 +98,7 @@
|
|||
<file>images/scriptset.png</file>
|
||||
<file>images/setting.png</file>
|
||||
<file>images/settingplugin.png</file>
|
||||
<file>images/shell.png</file>
|
||||
<file>images/soft.png</file>
|
||||
<file>images/sponsor.png</file>
|
||||
<file>images/structure.png</file>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#include "dockcomponentsfactory.h"
|
||||
|
||||
#include "DockWidget.h"
|
||||
#include "control/dockwidgettab.h"
|
||||
|
||||
ads::CDockWidgetTab *
|
||||
DockComponentsFactory::createDockWidgetTab(ads::CDockWidget *DockWidget) const {
|
||||
return new DockWidgetTab(DockWidget);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef DOCKCOMPONENTSFACTORY_H
|
||||
#define DOCKCOMPONENTSFACTORY_H
|
||||
|
||||
#include "Qt-Advanced-Docking-System/src/DockComponentsFactory.h"
|
||||
|
||||
class DockComponentsFactory : public ads::CDockComponentsFactory {
|
||||
public:
|
||||
// CDockComponentsFactory interface
|
||||
public:
|
||||
virtual ads::CDockWidgetTab *
|
||||
createDockWidgetTab(ads::CDockWidget *DockWidget) const override;
|
||||
};
|
||||
|
||||
#endif // DOCKCOMPONENTSFACTORY_H
|
|
@ -0,0 +1,135 @@
|
|||
#include "showinshell.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QProcess>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include "wingmessagebox.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <QAxObject>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QTextBrowser>
|
||||
#include <QUuid>
|
||||
#include <ShObjIdl.h>
|
||||
#include <ShlDisp.h>
|
||||
#include <Windows.h>
|
||||
|
||||
bool ShowInShell::showInWindowsShell(const QString &filePath, bool deselect) {
|
||||
QFileInfo appFI(filePath);
|
||||
auto matchPath = appFI.dir().path().toLower();
|
||||
auto matchName = appFI.fileName().toLower();
|
||||
|
||||
QAxObject shellApp("Shell.Application");
|
||||
|
||||
QAxObject *windows = shellApp.querySubObject("Windows()");
|
||||
windows->disableMetaObject();
|
||||
auto count = windows->dynamicCall("Count()").toInt();
|
||||
qDebug() << count;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
QAxObject *win = windows->querySubObject("Item(QVariant)", {i});
|
||||
win->disableMetaObject();
|
||||
|
||||
auto program = win->dynamicCall("FullName()").toString();
|
||||
QFileInfo programFI(program);
|
||||
if (programFI.baseName().toLower() != "explorer")
|
||||
continue;
|
||||
auto url = win->dynamicCall("LocationURL()").toUrl();
|
||||
if (!url.isLocalFile())
|
||||
continue;
|
||||
auto path = url.path().mid(1).toLower();
|
||||
if (path != matchPath)
|
||||
continue;
|
||||
|
||||
QAxObject *doc = win->querySubObject("Document()");
|
||||
|
||||
QAxObject *folder = doc->querySubObject("Folder()");
|
||||
folder->disableMetaObject();
|
||||
QAxObject *folderItems = folder->querySubObject("Items()");
|
||||
folderItems->disableMetaObject();
|
||||
|
||||
QAxObject *ourEntry = {};
|
||||
int count = folderItems->dynamicCall("Count()").toInt();
|
||||
for (int j = 0; j < count; j++) {
|
||||
QAxObject *entry = folderItems->querySubObject("Item(QVariant)", j);
|
||||
entry->disableMetaObject();
|
||||
auto name = entry->dynamicCall("Name()").toString().toLower();
|
||||
if (name == matchName)
|
||||
ourEntry = entry;
|
||||
}
|
||||
if (ourEntry) {
|
||||
if (false)
|
||||
ourEntry->dynamicCall("InvokeVerb(QVariant)",
|
||||
QVariant()); // open etc.
|
||||
auto rc = doc->dynamicCall(
|
||||
"SelectItem(QVariant, int)", ourEntry->asVariant(),
|
||||
SVSI_SELECT | (deselect ? SVSI_DESELECTOTHERS : 0));
|
||||
auto hwnd = win->dynamicCall("HWND()").toLongLong();
|
||||
BringWindowToTop(HWND(hwnd));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#else
|
||||
bool ShowInShell::showInWindowsShell(const QString &filePath, bool deselect) {
|
||||
Q_UNUSED(filePath);
|
||||
Q_UNUSED(deselect);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool ShowInShell::showInGraphicalShell(QWidget *parent, const QString &pathIn,
|
||||
bool deselect) {
|
||||
const QFileInfo fileInfo(pathIn);
|
||||
// Mac, Windows support folder or file.
|
||||
if (HostOsInfo::isWindowsHost()) {
|
||||
if (showInWindowsShell(pathIn, deselect))
|
||||
return true;
|
||||
const auto explorer =
|
||||
QStandardPaths::findExecutable(QLatin1String("explorer.exe"));
|
||||
if (explorer.isEmpty()) {
|
||||
WingMessageBox::warning(
|
||||
parent,
|
||||
QApplication::translate("ShowInShell",
|
||||
"Launching Windows Explorer Failed"),
|
||||
QApplication::translate(
|
||||
"ShowInShell",
|
||||
"Could not find explorer.exe in path to launch "
|
||||
"Windows Explorer."));
|
||||
return false;
|
||||
}
|
||||
QStringList param;
|
||||
if (!fileInfo.isDir())
|
||||
param += QLatin1String("/select,");
|
||||
param += QDir::toNativeSeparators(fileInfo.canonicalFilePath());
|
||||
return QProcess::startDetached(explorer, param);
|
||||
} else if (HostOsInfo::isMacHost()) {
|
||||
QStringList openArgs;
|
||||
openArgs << QLatin1String("-R") << fileInfo.canonicalFilePath();
|
||||
int rc = QProcess::execute(QLatin1String("/usr/bin/open"), openArgs);
|
||||
return rc != -2 && rc != 1;
|
||||
} else {
|
||||
// we cannot select a file here, because no file browser really
|
||||
// supports it...
|
||||
const QString folder = fileInfo.isDir() ? fileInfo.absoluteFilePath()
|
||||
: fileInfo.absolutePath();
|
||||
const QString app = QLatin1String("xdg-open");
|
||||
QProcess browserProc;
|
||||
bool success = browserProc.startDetached(app, {folder});
|
||||
const QString error =
|
||||
QString::fromLocal8Bit(browserProc.readAllStandardError());
|
||||
success = success && error.isEmpty();
|
||||
return success;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef SHOWINSHELL_H
|
||||
#define SHOWINSHELL_H
|
||||
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
struct HostOsInfo {
|
||||
#ifdef Q_OS_MAC
|
||||
static constexpr bool isMacHost() { return true; }
|
||||
#else
|
||||
static constexpr bool isMacHost() { return false; }
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
static constexpr bool isWindowsHost() { return true; }
|
||||
#else
|
||||
static constexpr bool isWindowsHost() { return false; }
|
||||
#endif
|
||||
};
|
||||
|
||||
class ShowInShell {
|
||||
public:
|
||||
static bool showInGraphicalShell(QWidget *parent, const QString &pathIn,
|
||||
bool deselect);
|
||||
|
||||
private:
|
||||
static bool showInWindowsShell(const QString &filePath, bool deselect);
|
||||
};
|
||||
|
||||
#endif // SHOWINSHELL_H
|
|
@ -0,0 +1,55 @@
|
|||
#include "dockwidgettab.h"
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
#include "class/appmanager.h"
|
||||
#include "class/showinshell.h"
|
||||
#include "dialog/fileinfodialog.h"
|
||||
#include "editorview.h"
|
||||
#include "scripteditor.h"
|
||||
|
||||
DockWidgetTab::DockWidgetTab(ads::CDockWidget *DockWidget, QWidget *parent)
|
||||
: ads::CDockWidgetTab(DockWidget, parent) {}
|
||||
|
||||
QMenu *DockWidgetTab::buildContextMenu(QMenu *menu) {
|
||||
if (menu == nullptr) {
|
||||
menu = new QMenu(this);
|
||||
}
|
||||
auto dw = dockWidget();
|
||||
auto v = qobject_cast<EditorView *>(dw);
|
||||
if (v) {
|
||||
if (v->isRegionFile() || v->isCommonFile()) {
|
||||
initMenuItems(menu, v->fileName());
|
||||
}
|
||||
auto a = new QAction(ICONRES("info"), tr("FileInfo"), menu);
|
||||
connect(a, &QAction::triggered, this, [this]() {
|
||||
auto editor = qobject_cast<EditorView *>(dockWidget());
|
||||
if (editor) {
|
||||
FileInfoDialog d(editor->fileName(),
|
||||
editor->documentType() ==
|
||||
EditorView::DocumentType::RegionFile);
|
||||
d.exec();
|
||||
}
|
||||
});
|
||||
menu->addAction(a);
|
||||
menu->addSeparator();
|
||||
} else {
|
||||
auto v = qobject_cast<ScriptEditor *>(dw);
|
||||
if (v) {
|
||||
initMenuItems(menu, v->fileName());
|
||||
menu->addSeparator();
|
||||
}
|
||||
}
|
||||
|
||||
return ads::CDockWidgetTab::buildContextMenu(menu);
|
||||
}
|
||||
|
||||
void DockWidgetTab::initMenuItems(QMenu *menu, const QString &path) {
|
||||
Q_ASSERT(menu);
|
||||
auto a = new QAction(ICONRES("shell"), tr("ShowInShell"), menu);
|
||||
connect(a, &QAction::triggered, this, [this, path]() {
|
||||
ShowInShell::showInGraphicalShell(AppManager::instance()->mainWindow(),
|
||||
path, false);
|
||||
});
|
||||
menu->addAction(a);
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef DOCKWIDGETTAB_H
|
||||
#define DOCKWIDGETTAB_H
|
||||
|
||||
#include "Qt-Advanced-Docking-System/src/DockWidgetTab.h"
|
||||
|
||||
class DockWidgetTab : public ads::CDockWidgetTab {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DockWidgetTab(ads::CDockWidget *DockWidget, QWidget *parent = nullptr);
|
||||
|
||||
// CDockAreaTitleBar interface
|
||||
public:
|
||||
virtual QMenu *buildContextMenu(QMenu *menu) override;
|
||||
|
||||
private:
|
||||
void initMenuItems(QMenu *menu, const QString &path);
|
||||
};
|
||||
|
||||
#endif // DOCKWIDGETTAB_H
|
|
@ -73,22 +73,6 @@ EditorView::EditorView(QWidget *parent)
|
|||
|
||||
m_stack->addWidget(m_hexContainer);
|
||||
|
||||
auto efilter = new EventFilter(QEvent::MouseButtonPress, this->tabWidget());
|
||||
connect(efilter, &EventFilter::eventTriggered, this,
|
||||
[this](QObject *obj, QEvent *event) {
|
||||
Q_UNUSED(obj);
|
||||
auto e = reinterpret_cast<QMouseEvent *>(event);
|
||||
if (e->modifiers() == Qt::NoModifier &&
|
||||
e->button() == Qt::MiddleButton) {
|
||||
FileInfoDialog fd(m_fileName, this->documentType() ==
|
||||
DocumentType::RegionFile);
|
||||
fd.exec();
|
||||
}
|
||||
});
|
||||
|
||||
auto tabWidget = this->tabWidget();
|
||||
tabWidget->installEventFilter(efilter);
|
||||
|
||||
m_menu = new QMenu(m_hex);
|
||||
auto &shortcut = QKeySequences::instance();
|
||||
|
||||
|
@ -972,6 +956,13 @@ bool EditorView::isRegionFile() const {
|
|||
return m_docType == EditorView::DocumentType::RegionFile;
|
||||
}
|
||||
|
||||
bool EditorView::isCommonFile() const {
|
||||
if (isCloneFile()) {
|
||||
return this->cloneParent()->isCommonFile();
|
||||
}
|
||||
return m_docType == EditorView::DocumentType::File;
|
||||
}
|
||||
|
||||
FindResultModel *EditorView::findResultModel() const {
|
||||
if (isCloneFile()) {
|
||||
return this->cloneParent()->findResultModel();
|
||||
|
|
|
@ -71,6 +71,7 @@ public:
|
|||
bool isDriver() const;
|
||||
bool isExtensionFile() const;
|
||||
bool isRegionFile() const;
|
||||
bool isCommonFile() const;
|
||||
|
||||
FindResultModel *findResultModel() const;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "aboutsoftwaredialog.h"
|
||||
#include "checksumdialog.h"
|
||||
#include "class/appmanager.h"
|
||||
#include "class/dockcomponentsfactory.h"
|
||||
#include "class/eventfilter.h"
|
||||
#include "class/langservice.h"
|
||||
#include "class/languagemanager.h"
|
||||
|
@ -394,6 +395,8 @@ void MainWindow::buildUpDockSystem(QWidget *container) {
|
|||
|
||||
qApp->processEvents();
|
||||
|
||||
ads::CDockComponentsFactory::setFactory(new DockComponentsFactory);
|
||||
|
||||
m_dock = new CDockManager;
|
||||
m_dock->setStyleSheet(QString());
|
||||
m_dock->setParent(this);
|
||||
|
|
Loading…
Reference in New Issue