fix: 修复代码编辑器自动缩进;代码编译信息合并和行号;分离插件SDK;
This commit is contained in:
parent
77bec99ac5
commit
9a3d1c040a
|
@ -14,3 +14,6 @@
|
||||||
[submodule "3rdparty/WingCodeEdit"]
|
[submodule "3rdparty/WingCodeEdit"]
|
||||||
path = 3rdparty/WingCodeEdit
|
path = 3rdparty/WingCodeEdit
|
||||||
url = git@github.com:Wing-summer/WingCodeEdit.git
|
url = git@github.com:Wing-summer/WingCodeEdit.git
|
||||||
|
[submodule "WingPlugin"]
|
||||||
|
path = WingPlugin
|
||||||
|
url = git@github.com:Wing-summer/WingHexExplorer2-SDK.git
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 608ab834bd9934e1aa7b4a0417e22e9f4f14da1a
|
Subproject commit fe0774c1d2ff5c86832d5850c1dccbbf3a6c3c66
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit f58ba0b04c7d11c9221386d0aaec44479466c454
|
|
@ -1,44 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 3.16)
|
|
||||||
|
|
||||||
project(WingPlugin LANGUAGES CXX)
|
|
||||||
|
|
||||||
set(CMAKE_AUTOUIC ON)
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
set(CMAKE_AUTORCC ON)
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
|
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
|
|
||||||
|
|
||||||
add_library(
|
|
||||||
WingPlugin SHARED
|
|
||||||
iwingplugin.cpp
|
|
||||||
iwingplugin.h
|
|
||||||
iwingpluginbase.h
|
|
||||||
iwingpluginbase.cpp
|
|
||||||
wingplugin_global.h
|
|
||||||
wingcore.h
|
|
||||||
wingplugincalls.h
|
|
||||||
wingplugincalls.cpp
|
|
||||||
wingplugincalls_p.h
|
|
||||||
wingeditorviewwidget.h
|
|
||||||
wingeditorviewwidget.cpp
|
|
||||||
settingpage.h
|
|
||||||
iwingdevice.h
|
|
||||||
iwingdevice.cpp
|
|
||||||
settingpage.cpp
|
|
||||||
iwingpluginbasecalls.h
|
|
||||||
iwingpluginbasecalls.cpp
|
|
||||||
iwingplugincalls.h
|
|
||||||
iwingplugincalls.cpp
|
|
||||||
wingplugincallconvertor.h
|
|
||||||
wingplugincallconvertor.cpp
|
|
||||||
wingpluginwidget.h
|
|
||||||
wingpluginwidget.cpp)
|
|
||||||
|
|
||||||
target_link_libraries(WingPlugin PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
|
|
||||||
|
|
||||||
target_include_directories(WingPlugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
|
||||||
|
|
||||||
target_compile_definitions(WingPlugin PRIVATE WINGPLUGIN_LIBRARY)
|
|
|
@ -1,29 +0,0 @@
|
||||||
BSD 3-Clause License
|
|
||||||
|
|
||||||
Copyright (c) 2018, the respective contributors, as shown by the AUTHORS file.
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
* Neither the name of the copyright holder nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
@ -1,33 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "iwingdevice.h"
|
|
||||||
|
|
||||||
using namespace WingHex;
|
|
||||||
|
|
||||||
IWingDevice::IWingDevice(QObject *parent) : IWingPluginBase() {}
|
|
||||||
|
|
||||||
QIcon IWingDevice::supportedFileIcon() const { return {}; }
|
|
||||||
|
|
||||||
QString IWingDevice::onOpenFileBegin() { return {}; }
|
|
||||||
|
|
||||||
WingIODevice::WingIODevice(QObject *parent) : QIODevice(parent) {}
|
|
||||||
|
|
||||||
bool WingIODevice::keepSize() const { return false; }
|
|
|
@ -1,62 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef IWINGDEVICE_H
|
|
||||||
#define IWINGDEVICE_H
|
|
||||||
|
|
||||||
#include "iwingpluginbase.h"
|
|
||||||
|
|
||||||
#include <QIODevice>
|
|
||||||
|
|
||||||
namespace WingHex {
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT WingIODevice : public QIODevice {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
WingIODevice(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
// can not change size during editing (default: changing-abled)
|
|
||||||
virtual bool keepSize() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT IWingDevice : public IWingPluginBase {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit IWingDevice(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual QString supportedFileExtDisplayName() const = 0;
|
|
||||||
|
|
||||||
virtual QIcon supportedFileIcon() const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual QString onOpenFileBegin();
|
|
||||||
|
|
||||||
virtual WingIODevice *onOpenFile(const QString &path) = 0;
|
|
||||||
|
|
||||||
virtual bool onCloseFile(WingIODevice *dev) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace WingHex
|
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(WingHex::IWingDevice, "com.wingsummer.iwingdevice")
|
|
||||||
|
|
||||||
#endif // IWINGDEVICE_H
|
|
|
@ -1,113 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "iwingplugin.h"
|
|
||||||
|
|
||||||
using namespace WingHex;
|
|
||||||
|
|
||||||
IWingPlugin::IWingPlugin() : IWingPluginBase(), IWingPluginCalls(this) {}
|
|
||||||
|
|
||||||
QVariant IWingPlugin::getScriptCallError(int errCode, const QString &msg) {
|
|
||||||
ScriptCallError err;
|
|
||||||
|
|
||||||
err.errorCode = errCode;
|
|
||||||
err.errmsg = msg;
|
|
||||||
|
|
||||||
return QVariant::fromValue(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
IWingPlugin::RegisteredEvents IWingPlugin::registeredEvents() const {
|
|
||||||
return RegisteredEvent::None;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMenu *IWingPlugin::registeredHexContextMenu() const { return nullptr; }
|
|
||||||
|
|
||||||
QList<WingRibbonToolBoxInfo> IWingPlugin::registeredRibbonTools() const {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
QHash<SettingPage *, bool> IWingPlugin::registeredSettingPages() const {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QSharedPointer<WingEditorViewWidget::Creator>>
|
|
||||||
IWingPlugin::registeredEditorViewWidgets() const {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
QHash<QString, QList<QPair<QString, int>>>
|
|
||||||
IWingPlugin::registeredScriptEnums() const {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList IWingPlugin::registerScriptMarcos() const { return {}; }
|
|
||||||
|
|
||||||
void IWingPlugin::eventSelectionChanged(const QByteArrayList &selections,
|
|
||||||
bool isPreview) {
|
|
||||||
Q_UNUSED(selections);
|
|
||||||
Q_UNUSED(isPreview);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IWingPlugin::eventCursorPositionChanged(const HexPosition &pos) {
|
|
||||||
Q_UNUSED(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IWingPlugin::eventPluginFile(PluginFileEvent e, FileType type,
|
|
||||||
const QString &newfileName, int handle,
|
|
||||||
const QString &oldfileName) {
|
|
||||||
Q_UNUSED(e);
|
|
||||||
Q_UNUSED(newfileName);
|
|
||||||
Q_UNUSED(oldfileName);
|
|
||||||
Q_UNUSED(handle);
|
|
||||||
Q_UNUSED(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IWingPlugin::eventReady() {}
|
|
||||||
|
|
||||||
bool IWingPlugin::eventClosing() { return true; }
|
|
||||||
|
|
||||||
bool IWingPlugin::eventOnScriptPragma(const QString &script,
|
|
||||||
const QStringList &comments) {
|
|
||||||
Q_UNUSED(script);
|
|
||||||
Q_UNUSED(comments);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IWingPlugin::eventOnScriptPragmaInit() {}
|
|
||||||
|
|
||||||
QHash<QString, IWingPlugin::UNSAFE_SCFNPTR>
|
|
||||||
IWingPlugin::registeredScriptUnsafeFns() const {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
QHash<QString, IWingPlugin::ScriptFnInfo>
|
|
||||||
IWingPlugin::registeredScriptFns() const {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
ScriptCallError IWingPlugin::generateScriptCallError(int errCode,
|
|
||||||
const QString &msg) {
|
|
||||||
ScriptCallError err;
|
|
||||||
|
|
||||||
err.errorCode = errCode;
|
|
||||||
err.errmsg = msg;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
|
@ -1,223 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef IWINGPLUGIN_H
|
|
||||||
#define IWINGPLUGIN_H
|
|
||||||
|
|
||||||
#include "WingPlugin/iwingplugincalls.h"
|
|
||||||
#include "iwingpluginbase.h"
|
|
||||||
#include "wingeditorviewwidget.h"
|
|
||||||
#include "wingplugin_global.h"
|
|
||||||
|
|
||||||
#include <variant>
|
|
||||||
|
|
||||||
#include <QToolButton>
|
|
||||||
|
|
||||||
namespace WingHex {
|
|
||||||
|
|
||||||
class IWingPlugin;
|
|
||||||
|
|
||||||
struct WINGPLUGIN_EXPORT SenderInfo {
|
|
||||||
QString plgcls;
|
|
||||||
QString puid;
|
|
||||||
QVariant meta;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct WINGPLUGIN_EXPORT WingRibbonToolBoxInfo {
|
|
||||||
struct WINGPLUGIN_EXPORT RibbonCatagories {
|
|
||||||
const QString FILE = QStringLiteral("File");
|
|
||||||
const QString EDIT = QStringLiteral("Edit");
|
|
||||||
const QString VIEW = QStringLiteral("View");
|
|
||||||
const QString SCRIPT = QStringLiteral("Script");
|
|
||||||
const QString PLUGIN = QStringLiteral("Plugin");
|
|
||||||
const QString SETTING = QStringLiteral("Setting");
|
|
||||||
const QString ABOUT = QStringLiteral("About");
|
|
||||||
};
|
|
||||||
|
|
||||||
QString catagory;
|
|
||||||
QString displayName;
|
|
||||||
|
|
||||||
struct WINGPLUGIN_EXPORT Toolbox {
|
|
||||||
QString name;
|
|
||||||
QList<QToolButton *> tools;
|
|
||||||
};
|
|
||||||
QList<Toolbox> toolboxs;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct WINGPLUGIN_EXPORT ScriptCallError {
|
|
||||||
int errorCode;
|
|
||||||
QString errmsg;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SettingPage;
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT IWingPlugin : public IWingPluginBase,
|
|
||||||
public IWingPluginCalls {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
IWingPlugin();
|
|
||||||
|
|
||||||
public:
|
|
||||||
using ScriptFn = std::function<QVariant(const QVariantList &)>;
|
|
||||||
|
|
||||||
using UNSAFE_RET =
|
|
||||||
std::variant<std::monostate, bool, quint8, quint16, quint32, quint64,
|
|
||||||
float, double, void *, ScriptCallError>;
|
|
||||||
using UNSAFE_SCFNPTR = std::function<UNSAFE_RET(const QList<void *> &)>;
|
|
||||||
|
|
||||||
enum MetaType : uint {
|
|
||||||
Void,
|
|
||||||
|
|
||||||
Bool,
|
|
||||||
Int,
|
|
||||||
Int32 = Int,
|
|
||||||
UInt,
|
|
||||||
UInt32 = UInt,
|
|
||||||
Int8,
|
|
||||||
UInt8,
|
|
||||||
Int16,
|
|
||||||
UInt16,
|
|
||||||
Int64,
|
|
||||||
UInt64,
|
|
||||||
|
|
||||||
Float,
|
|
||||||
Double,
|
|
||||||
|
|
||||||
String,
|
|
||||||
Char,
|
|
||||||
Byte,
|
|
||||||
Color,
|
|
||||||
|
|
||||||
Map, // QVariantMap -> dictionary
|
|
||||||
Hash, // QVariantHash -> dictionary
|
|
||||||
|
|
||||||
MetaMax, // reserved
|
|
||||||
MetaTypeMask = 0xFFFFF,
|
|
||||||
Array = 0x100000, // QVector<?> -> array<?>
|
|
||||||
List = 0x200000, // QList<?> -> array<?>
|
|
||||||
};
|
|
||||||
|
|
||||||
static_assert(MetaType::MetaMax < MetaType::Array);
|
|
||||||
|
|
||||||
struct ScriptFnInfo {
|
|
||||||
MetaType ret;
|
|
||||||
QVector<QPair<MetaType, QString>> params;
|
|
||||||
ScriptFn fn;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class RegisteredEvent : uint {
|
|
||||||
None,
|
|
||||||
AppReady = 1u,
|
|
||||||
AppClosing = 1u << 1,
|
|
||||||
SelectionChanged = 1u << 2,
|
|
||||||
CursorPositionChanged = 1u << 3,
|
|
||||||
FileOpened = 1u << 4,
|
|
||||||
FileSaved = 1u << 5,
|
|
||||||
FileSwitched = 1u << 6,
|
|
||||||
FileClosed = 1u << 7,
|
|
||||||
ScriptPragma = 1u << 8,
|
|
||||||
PluginFileOpened = 1u << 9,
|
|
||||||
PluginFileClosed = 1u << 10,
|
|
||||||
ScriptUnSafeFnRegistering = 1u << 11,
|
|
||||||
ScriptPragmaInit = 1u << 12
|
|
||||||
};
|
|
||||||
Q_DECLARE_FLAGS(RegisteredEvents, RegisteredEvent)
|
|
||||||
|
|
||||||
enum class PluginFileEvent {
|
|
||||||
Opened,
|
|
||||||
Saved,
|
|
||||||
Exported,
|
|
||||||
Switched,
|
|
||||||
Closed,
|
|
||||||
PluginOpened,
|
|
||||||
PluginClosed
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class FileType { Invalid, File, Extension };
|
|
||||||
Q_ENUM(FileType)
|
|
||||||
|
|
||||||
public:
|
|
||||||
ScriptCallError generateScriptCallError(int errCode, const QString &msg);
|
|
||||||
|
|
||||||
QVariant getScriptCallError(int errCode, const QString &msg);
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual ~IWingPlugin() = default;
|
|
||||||
|
|
||||||
virtual RegisteredEvents registeredEvents() const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual QMenu *registeredHexContextMenu() const;
|
|
||||||
virtual QList<WingRibbonToolBoxInfo> registeredRibbonTools() const;
|
|
||||||
// QMap<page, whether is visible in setting tab>
|
|
||||||
virtual QHash<SettingPage *, bool> registeredSettingPages() const;
|
|
||||||
|
|
||||||
virtual QList<QSharedPointer<WingEditorViewWidget::Creator>>
|
|
||||||
registeredEditorViewWidgets() const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
// QHash< function-name, fn >
|
|
||||||
virtual QHash<QString, ScriptFnInfo> registeredScriptFns() const;
|
|
||||||
|
|
||||||
// A hacking way to register script function (Generic_Call)
|
|
||||||
// This registering way is not safe. There is no
|
|
||||||
// other checking except function's signature.
|
|
||||||
// You should handle your all the types and pay yourself.
|
|
||||||
|
|
||||||
// You should set RegisteredEvent::ScriptFnRegistering ON to enable it.
|
|
||||||
|
|
||||||
// QHash< function-name, fn >
|
|
||||||
virtual QHash<QString, UNSAFE_SCFNPTR> registeredScriptUnsafeFns() const;
|
|
||||||
|
|
||||||
// QHash< enum , members >
|
|
||||||
virtual QHash<QString, QList<QPair<QString, int>>>
|
|
||||||
registeredScriptEnums() const;
|
|
||||||
|
|
||||||
// Note: must be valid identifier
|
|
||||||
virtual QStringList registerScriptMarcos() const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual void eventSelectionChanged(const QByteArrayList &selections,
|
|
||||||
bool isPreview);
|
|
||||||
|
|
||||||
virtual void eventCursorPositionChanged(const WingHex::HexPosition &pos);
|
|
||||||
|
|
||||||
virtual void eventPluginFile(PluginFileEvent e, FileType type,
|
|
||||||
const QString &newfileName, int handle,
|
|
||||||
const QString &oldfileName);
|
|
||||||
|
|
||||||
virtual void eventReady();
|
|
||||||
|
|
||||||
virtual bool eventClosing();
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual bool eventOnScriptPragma(const QString &script,
|
|
||||||
const QStringList &comments);
|
|
||||||
|
|
||||||
virtual void eventOnScriptPragmaInit();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace WingHex
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(WingHex::SenderInfo)
|
|
||||||
Q_DECLARE_METATYPE(WingHex::ScriptCallError)
|
|
||||||
Q_DECLARE_INTERFACE(WingHex::IWingPlugin, "com.wingsummer.iwingplugin")
|
|
||||||
|
|
||||||
#endif // IWINGPLUGIN_H
|
|
|
@ -1,47 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "iwingpluginbase.h"
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QMetaMethod>
|
|
||||||
|
|
||||||
using namespace WingHex;
|
|
||||||
|
|
||||||
IWingPluginBase::IWingPluginBase() : IWingPluginBaseCalls(this) {}
|
|
||||||
|
|
||||||
QIcon IWingPluginBase::pluginIcon() const { return {}; }
|
|
||||||
|
|
||||||
QString IWingPluginBase::retranslate(const QString &str) { return str; }
|
|
||||||
|
|
||||||
QList<WingDockWidgetInfo> IWingPluginBase::registeredDockWidgets() const {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<PluginPage *> IWingPluginBase::registeredPages() const { return {}; }
|
|
||||||
|
|
||||||
QString WingHex::PLUGINDIR() {
|
|
||||||
return QCoreApplication::applicationDirPath() + QStringLiteral("/plugin");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString WingHex::HOSTRESPIMG(const QString &name, const QString &suffix) {
|
|
||||||
return QStringLiteral(":/com.wingsummer.winghex/images/") + name + suffix;
|
|
||||||
}
|
|
|
@ -1,68 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef IWINGPLUGINBASE_H
|
|
||||||
#define IWINGPLUGINBASE_H
|
|
||||||
|
|
||||||
#include "WingPlugin/iwingpluginbasecalls.h"
|
|
||||||
#include "wingplugin_global.h"
|
|
||||||
|
|
||||||
#include <QSettings>
|
|
||||||
|
|
||||||
namespace WingHex {
|
|
||||||
|
|
||||||
Q_DECL_UNUSED constexpr auto SDKVERSION = 16;
|
|
||||||
|
|
||||||
WINGPLUGIN_EXPORT QString PLUGINDIR();
|
|
||||||
|
|
||||||
WINGPLUGIN_EXPORT QString HOSTRESPIMG(
|
|
||||||
const QString &name, const QString &suffix = QStringLiteral(".png"));
|
|
||||||
|
|
||||||
class PluginPage;
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT IWingPluginBase : public QObject,
|
|
||||||
public IWingPluginBaseCalls {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
IWingPluginBase();
|
|
||||||
virtual ~IWingPluginBase() = default;
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual int sdkVersion() const = 0;
|
|
||||||
|
|
||||||
virtual bool init(const std::unique_ptr<QSettings> &set) = 0;
|
|
||||||
virtual void unload(std::unique_ptr<QSettings> &set) = 0;
|
|
||||||
|
|
||||||
virtual const QString pluginName() const = 0;
|
|
||||||
virtual QIcon pluginIcon() const;
|
|
||||||
virtual const QString pluginComment() const = 0;
|
|
||||||
|
|
||||||
virtual QString retranslate(const QString &str);
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual QList<WingDockWidgetInfo> registeredDockWidgets() const;
|
|
||||||
|
|
||||||
virtual QList<PluginPage *> registeredPages() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace WingHex
|
|
||||||
|
|
||||||
#endif // IWINGPLUGINBASE_H
|
|
|
@ -1,302 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "iwingpluginbasecalls.h"
|
|
||||||
|
|
||||||
#include "WingPlugin/wingcore.h"
|
|
||||||
#include "iwingpluginbase.h"
|
|
||||||
|
|
||||||
using namespace WingHex;
|
|
||||||
|
|
||||||
IWingPluginBaseCalls::IWingPluginBaseCalls(IWingPluginBase *const caller)
|
|
||||||
: WingPluginCalls(caller) {}
|
|
||||||
|
|
||||||
void IWingPluginBaseCalls::toast(const QPixmap &icon, const QString &message) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::toast);
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
|
||||||
WINGAPI_ARG(icon), WINGAPI_ARG(message));
|
|
||||||
}
|
|
||||||
|
|
||||||
void IWingPluginBaseCalls::logTrace(const QString &message) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::logTrace);
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
|
||||||
WINGAPI_ARG(message));
|
|
||||||
}
|
|
||||||
|
|
||||||
void IWingPluginBaseCalls::logDebug(const QString &message) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::logDebug);
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
|
||||||
WINGAPI_ARG(message));
|
|
||||||
}
|
|
||||||
|
|
||||||
void IWingPluginBaseCalls::logWarn(const QString &message) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::logWarn);
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
|
||||||
WINGAPI_ARG(message));
|
|
||||||
}
|
|
||||||
|
|
||||||
void IWingPluginBaseCalls::logError(const QString &message) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::logError);
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
|
||||||
WINGAPI_ARG(message));
|
|
||||||
}
|
|
||||||
|
|
||||||
void IWingPluginBaseCalls::logInfo(const QString &message) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::logInfo);
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
|
||||||
WINGAPI_ARG(message));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IWingPluginBaseCalls::raiseDockWidget(QWidget *w) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::raiseDockWidget);
|
|
||||||
bool ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(w));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDialog *IWingPluginBaseCalls::createDialog(QWidget *content) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::createDialog);
|
|
||||||
QDialog *ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(content));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IWingPluginBaseCalls::msgAboutQt(QWidget *parent, const QString &title) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::msgAboutQt);
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
|
||||||
WINGAPI_ARG(parent), WINGAPI_ARG(title));
|
|
||||||
}
|
|
||||||
|
|
||||||
QMessageBox::StandardButton IWingPluginBaseCalls::msgInformation(
|
|
||||||
QWidget *parent, const QString &title, const QString &text,
|
|
||||||
QMessageBox::StandardButtons buttons,
|
|
||||||
QMessageBox::StandardButton defaultButton) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::msgInformation);
|
|
||||||
QMessageBox::StandardButton ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
|
||||||
WINGAPI_ARG(text), WINGAPI_ARG(buttons),
|
|
||||||
WINGAPI_ARG(defaultButton));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMessageBox::StandardButton
|
|
||||||
IWingPluginBaseCalls::msgQuestion(QWidget *parent, const QString &title,
|
|
||||||
const QString &text,
|
|
||||||
QMessageBox::StandardButtons buttons,
|
|
||||||
QMessageBox::StandardButton defaultButton) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::msgQuestion);
|
|
||||||
QMessageBox::StandardButton ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
|
||||||
WINGAPI_ARG(text), WINGAPI_ARG(buttons),
|
|
||||||
WINGAPI_ARG(defaultButton));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMessageBox::StandardButton
|
|
||||||
IWingPluginBaseCalls::msgWarning(QWidget *parent, const QString &title,
|
|
||||||
const QString &text,
|
|
||||||
QMessageBox::StandardButtons buttons,
|
|
||||||
QMessageBox::StandardButton defaultButton) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::msgWarning);
|
|
||||||
QMessageBox::StandardButton ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
|
||||||
WINGAPI_ARG(text), WINGAPI_ARG(buttons),
|
|
||||||
WINGAPI_ARG(defaultButton));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMessageBox::StandardButton
|
|
||||||
IWingPluginBaseCalls::critical(QWidget *parent, const QString &title,
|
|
||||||
const QString &text,
|
|
||||||
QMessageBox::StandardButtons buttons,
|
|
||||||
QMessageBox::StandardButton defaultButton) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::critical);
|
|
||||||
QMessageBox::StandardButton ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
|
||||||
WINGAPI_ARG(text), WINGAPI_ARG(buttons),
|
|
||||||
WINGAPI_ARG(defaultButton));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IWingPluginBaseCalls::msgAbout(QWidget *parent, const QString &title,
|
|
||||||
const QString &text) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::msgAbout);
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
|
||||||
WINGAPI_ARG(parent), WINGAPI_ARG(title), WINGAPI_ARG(text));
|
|
||||||
}
|
|
||||||
|
|
||||||
QMessageBox::StandardButton
|
|
||||||
IWingPluginBaseCalls::msgbox(QWidget *parent, QMessageBox::Icon icon,
|
|
||||||
const QString &title, const QString &text,
|
|
||||||
QMessageBox::StandardButtons buttons,
|
|
||||||
QMessageBox::StandardButton defaultButton) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::msgbox);
|
|
||||||
QMessageBox::StandardButton ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(icon),
|
|
||||||
WINGAPI_ARG(title), WINGAPI_ARG(text), WINGAPI_ARG(buttons),
|
|
||||||
WINGAPI_ARG(defaultButton));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString
|
|
||||||
IWingPluginBaseCalls::dlgGetText(QWidget *parent, const QString &title,
|
|
||||||
const QString &label, QLineEdit::EchoMode echo,
|
|
||||||
const QString &text, bool *ok,
|
|
||||||
Qt::InputMethodHints inputMethodHints) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetText);
|
|
||||||
QString ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
|
||||||
WINGAPI_ARG(label), WINGAPI_ARG(echo), WINGAPI_ARG(text),
|
|
||||||
WINGAPI_ARG(ok), WINGAPI_ARG(inputMethodHints));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString IWingPluginBaseCalls::dlgGetMultiLineText(
|
|
||||||
QWidget *parent, const QString &title, const QString &label,
|
|
||||||
const QString &text, bool *ok, Qt::InputMethodHints inputMethodHints) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetMultiLineText);
|
|
||||||
QString ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
|
||||||
WINGAPI_ARG(label), WINGAPI_ARG(text), WINGAPI_ARG(ok),
|
|
||||||
WINGAPI_ARG(inputMethodHints));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString
|
|
||||||
IWingPluginBaseCalls::dlgGetItem(QWidget *parent, const QString &title,
|
|
||||||
const QString &label, const QStringList &items,
|
|
||||||
int current, bool editable, bool *ok,
|
|
||||||
Qt::InputMethodHints inputMethodHints) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetItem);
|
|
||||||
QString ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
|
||||||
WINGAPI_ARG(label), WINGAPI_ARG(items), WINGAPI_ARG(current),
|
|
||||||
WINGAPI_ARG(editable), WINGAPI_ARG(ok),
|
|
||||||
WINGAPI_ARG(inputMethodHints));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int IWingPluginBaseCalls::dlgGetInt(QWidget *parent, const QString &title,
|
|
||||||
const QString &label, int value,
|
|
||||||
int minValue, int maxValue, int step,
|
|
||||||
bool *ok) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetInt);
|
|
||||||
int ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
|
||||||
WINGAPI_ARG(label), WINGAPI_ARG(value), WINGAPI_ARG(minValue),
|
|
||||||
WINGAPI_ARG(maxValue), WINGAPI_ARG(step), WINGAPI_ARG(ok));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
double IWingPluginBaseCalls::dlgGetDouble(QWidget *parent, const QString &title,
|
|
||||||
const QString &label, double value,
|
|
||||||
double minValue, double maxValue,
|
|
||||||
int decimals, bool *ok, double step) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetDouble);
|
|
||||||
double ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
|
||||||
WINGAPI_ARG(label), WINGAPI_ARG(value), WINGAPI_ARG(minValue),
|
|
||||||
WINGAPI_ARG(maxValue), WINGAPI_ARG(decimals), WINGAPI_ARG(ok),
|
|
||||||
WINGAPI_ARG(step));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString IWingPluginBaseCalls::dlgGetExistingDirectory(
|
|
||||||
QWidget *parent, const QString &caption, const QString &dir,
|
|
||||||
QFileDialog::Options options) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetExistingDirectory);
|
|
||||||
QString ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(caption),
|
|
||||||
WINGAPI_ARG(dir), WINGAPI_ARG(options));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString IWingPluginBaseCalls::dlgGetOpenFileName(QWidget *parent,
|
|
||||||
const QString &caption,
|
|
||||||
const QString &dir,
|
|
||||||
const QString &filter,
|
|
||||||
QString *selectedFilter,
|
|
||||||
QFileDialog::Options options) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetOpenFileName);
|
|
||||||
QString ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(caption),
|
|
||||||
WINGAPI_ARG(dir), WINGAPI_ARG(filter), WINGAPI_ARG(selectedFilter),
|
|
||||||
WINGAPI_ARG(options));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList IWingPluginBaseCalls::dlgGetOpenFileNames(
|
|
||||||
QWidget *parent, const QString &caption, const QString &dir,
|
|
||||||
const QString &filter, QString *selectedFilter,
|
|
||||||
QFileDialog::Options options) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetOpenFileNames);
|
|
||||||
QStringList ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(caption),
|
|
||||||
WINGAPI_ARG(dir), WINGAPI_ARG(filter), WINGAPI_ARG(selectedFilter),
|
|
||||||
WINGAPI_ARG(options));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString IWingPluginBaseCalls::dlgGetSaveFileName(QWidget *parent,
|
|
||||||
const QString &caption,
|
|
||||||
const QString &dir,
|
|
||||||
const QString &filter,
|
|
||||||
QString *selectedFilter,
|
|
||||||
QFileDialog::Options options) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetSaveFileName);
|
|
||||||
QString ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(caption),
|
|
||||||
WINGAPI_ARG(dir), WINGAPI_ARG(filter), WINGAPI_ARG(selectedFilter),
|
|
||||||
WINGAPI_ARG(options));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QColor IWingPluginBaseCalls::dlgGetColor(const QString &caption,
|
|
||||||
QWidget *parent) {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetColor);
|
|
||||||
QColor ret;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
|
||||||
getSenderObj(), WINGAPI_ARG(caption), WINGAPI_ARG(parent));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
AppTheme IWingPluginBaseCalls::currentAppTheme() {
|
|
||||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::currentAppTheme);
|
|
||||||
WingHex::AppTheme theme;
|
|
||||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(theme),
|
|
||||||
getSenderObj());
|
|
||||||
return theme;
|
|
||||||
}
|
|
|
@ -1,158 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef IWINGPLUGINBASECALLS_H
|
|
||||||
#define IWINGPLUGINBASECALLS_H
|
|
||||||
|
|
||||||
#include "WingPlugin/wingplugincallconvertor.h"
|
|
||||||
#include "wingplugincalls.h"
|
|
||||||
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QIcon>
|
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QList>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
namespace WingHex {
|
|
||||||
|
|
||||||
class IWingPluginBase;
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT IWingPluginBaseCalls : public WingPluginCalls {
|
|
||||||
public:
|
|
||||||
explicit IWingPluginBaseCalls(IWingPluginBase *const caller);
|
|
||||||
|
|
||||||
public:
|
|
||||||
void toast(const QPixmap &icon, const QString &message);
|
|
||||||
void logTrace(const QString &message);
|
|
||||||
void logDebug(const QString &message);
|
|
||||||
void logWarn(const QString &message);
|
|
||||||
void logError(const QString &message);
|
|
||||||
void logInfo(const QString &message);
|
|
||||||
|
|
||||||
bool raiseDockWidget(QWidget *w);
|
|
||||||
|
|
||||||
// theme
|
|
||||||
WingHex::AppTheme currentAppTheme();
|
|
||||||
|
|
||||||
// not available for AngelScript
|
|
||||||
// only for plugin UI extenstion
|
|
||||||
|
|
||||||
QDialog *createDialog(QWidget *content);
|
|
||||||
|
|
||||||
public:
|
|
||||||
void msgAboutQt(QWidget *parent = nullptr,
|
|
||||||
const QString &title = QString());
|
|
||||||
|
|
||||||
QMessageBox::StandardButton msgInformation(
|
|
||||||
QWidget *parent, const QString &title, const QString &text,
|
|
||||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
|
|
||||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
|
||||||
|
|
||||||
QMessageBox::StandardButton msgQuestion(
|
|
||||||
QWidget *parent, const QString &title, const QString &text,
|
|
||||||
QMessageBox::StandardButtons buttons =
|
|
||||||
QMessageBox::StandardButtons(QMessageBox::Yes | QMessageBox::No),
|
|
||||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
|
||||||
|
|
||||||
QMessageBox::StandardButton msgWarning(
|
|
||||||
QWidget *parent, const QString &title, const QString &text,
|
|
||||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
|
|
||||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
|
||||||
|
|
||||||
QMessageBox::StandardButton
|
|
||||||
critical(QWidget *parent, const QString &title, const QString &text,
|
|
||||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
|
|
||||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
|
||||||
|
|
||||||
void msgAbout(QWidget *parent, const QString &title, const QString &text);
|
|
||||||
|
|
||||||
QMessageBox::StandardButton
|
|
||||||
msgbox(QWidget *parent, QMessageBox::Icon icon, const QString &title,
|
|
||||||
const QString &text,
|
|
||||||
QMessageBox::StandardButtons buttons = QMessageBox::NoButton,
|
|
||||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
|
||||||
|
|
||||||
public:
|
|
||||||
Q_REQUIRED_RESULT QString
|
|
||||||
dlgGetText(QWidget *parent, const QString &title, const QString &label,
|
|
||||||
QLineEdit::EchoMode echo = QLineEdit::Normal,
|
|
||||||
const QString &text = QString(), bool *ok = nullptr,
|
|
||||||
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
|
|
||||||
Q_REQUIRED_RESULT QString dlgGetMultiLineText(
|
|
||||||
QWidget *parent, const QString &title, const QString &label,
|
|
||||||
const QString &text = QString(), bool *ok = nullptr,
|
|
||||||
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QString
|
|
||||||
dlgGetItem(QWidget *parent, const QString &title, const QString &label,
|
|
||||||
const QStringList &items, int current = 0, bool editable = true,
|
|
||||||
bool *ok = nullptr,
|
|
||||||
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT int dlgGetInt(QWidget *parent, const QString &title,
|
|
||||||
const QString &label, int value = 0,
|
|
||||||
int minValue = -2147483647,
|
|
||||||
int maxValue = 2147483647, int step = 1,
|
|
||||||
bool *ok = nullptr);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT double
|
|
||||||
dlgGetDouble(QWidget *parent, const QString &title, const QString &label,
|
|
||||||
double value = 0, double minValue = -2147483647,
|
|
||||||
double maxValue = 2147483647, int decimals = 1,
|
|
||||||
bool *ok = nullptr, double step = 1);
|
|
||||||
|
|
||||||
public:
|
|
||||||
Q_REQUIRED_RESULT QString dlgGetExistingDirectory(
|
|
||||||
QWidget *parent = nullptr, const QString &caption = QString(),
|
|
||||||
const QString &dir = QString(),
|
|
||||||
QFileDialog::Options options = QFileDialog::ShowDirsOnly);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QString dlgGetOpenFileName(
|
|
||||||
QWidget *parent = nullptr, const QString &caption = QString(),
|
|
||||||
const QString &dir = QString(), const QString &filter = QString(),
|
|
||||||
QString *selectedFilter = nullptr,
|
|
||||||
QFileDialog::Options options = QFileDialog::Options());
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QStringList dlgGetOpenFileNames(
|
|
||||||
QWidget *parent = nullptr, const QString &caption = QString(),
|
|
||||||
const QString &dir = QString(), const QString &filter = QString(),
|
|
||||||
QString *selectedFilter = nullptr,
|
|
||||||
QFileDialog::Options options = QFileDialog::Options());
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QString dlgGetSaveFileName(
|
|
||||||
QWidget *parent = nullptr, const QString &caption = QString(),
|
|
||||||
const QString &dir = QString(), const QString &filter = QString(),
|
|
||||||
QString *selectedFilter = nullptr,
|
|
||||||
QFileDialog::Options options = QFileDialog::Options());
|
|
||||||
|
|
||||||
public:
|
|
||||||
Q_REQUIRED_RESULT QColor dlgGetColor(const QString &caption,
|
|
||||||
QWidget *parent = nullptr);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace WingHex
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QMessageBox::StandardButtons)
|
|
||||||
Q_DECLARE_METATYPE(QMessageBox::StandardButton)
|
|
||||||
Q_DECLARE_METATYPE(bool *)
|
|
||||||
Q_DECLARE_METATYPE(QString *)
|
|
||||||
|
|
||||||
#endif // IWINGPLUGINBASECALLS_H
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,305 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef IWINGPLUGINCALLS_H
|
|
||||||
#define IWINGPLUGINCALLS_H
|
|
||||||
|
|
||||||
#include "WingPlugin/iwingpluginbasecalls.h"
|
|
||||||
|
|
||||||
#include <QAbstractItemModel>
|
|
||||||
|
|
||||||
namespace WingHex {
|
|
||||||
|
|
||||||
struct WINGPLUGIN_EXPORT HexPosition {
|
|
||||||
qsizetype line;
|
|
||||||
int column;
|
|
||||||
quint8 lineWidth;
|
|
||||||
int nibbleindex;
|
|
||||||
|
|
||||||
HexPosition();
|
|
||||||
Q_REQUIRED_RESULT qsizetype offset() const;
|
|
||||||
qsizetype operator-(const HexPosition &rhs) const;
|
|
||||||
bool operator==(const HexPosition &rhs) const;
|
|
||||||
bool operator!=(const HexPosition &rhs) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
class IWingPlugin;
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT IWingPluginCalls : public WingPluginCalls {
|
|
||||||
public:
|
|
||||||
explicit IWingPluginCalls(IWingPlugin *const caller);
|
|
||||||
|
|
||||||
public:
|
|
||||||
bool existsServiceHost(const QString &puid);
|
|
||||||
|
|
||||||
bool invokeService(const QString &puid, const char *method,
|
|
||||||
Qt::ConnectionType type, QGenericReturnArgument ret,
|
|
||||||
QGenericArgument val0 = QGenericArgument(nullptr),
|
|
||||||
QGenericArgument val1 = QGenericArgument(),
|
|
||||||
QGenericArgument val2 = QGenericArgument(),
|
|
||||||
QGenericArgument val3 = QGenericArgument(),
|
|
||||||
QGenericArgument val4 = QGenericArgument());
|
|
||||||
|
|
||||||
bool invokeService(const QString &puid, const char *member,
|
|
||||||
QGenericReturnArgument ret,
|
|
||||||
QGenericArgument val0 = QGenericArgument(nullptr),
|
|
||||||
QGenericArgument val1 = QGenericArgument(),
|
|
||||||
QGenericArgument val2 = QGenericArgument(),
|
|
||||||
QGenericArgument val3 = QGenericArgument(),
|
|
||||||
QGenericArgument val4 = QGenericArgument());
|
|
||||||
|
|
||||||
bool invokeService(const QString &puid, const char *member,
|
|
||||||
Qt::ConnectionType type, QGenericArgument val0,
|
|
||||||
QGenericArgument val1 = QGenericArgument(),
|
|
||||||
QGenericArgument val2 = QGenericArgument(),
|
|
||||||
QGenericArgument val3 = QGenericArgument(),
|
|
||||||
QGenericArgument val4 = QGenericArgument());
|
|
||||||
|
|
||||||
bool invokeService(const QString &puid, const char *member,
|
|
||||||
QGenericArgument val0,
|
|
||||||
QGenericArgument val1 = QGenericArgument(),
|
|
||||||
QGenericArgument val2 = QGenericArgument(),
|
|
||||||
QGenericArgument val3 = QGenericArgument(),
|
|
||||||
QGenericArgument val4 = QGenericArgument());
|
|
||||||
|
|
||||||
public:
|
|
||||||
Q_REQUIRED_RESULT bool isCurrentDocEditing();
|
|
||||||
Q_REQUIRED_RESULT QString currentDocFilename();
|
|
||||||
|
|
||||||
// document
|
|
||||||
Q_REQUIRED_RESULT bool isReadOnly();
|
|
||||||
Q_REQUIRED_RESULT bool isInsertionMode();
|
|
||||||
Q_REQUIRED_RESULT bool isKeepSize();
|
|
||||||
Q_REQUIRED_RESULT bool isLocked();
|
|
||||||
Q_REQUIRED_RESULT qsizetype documentLines();
|
|
||||||
Q_REQUIRED_RESULT qsizetype documentBytes();
|
|
||||||
Q_REQUIRED_RESULT WingHex::HexPosition currentPos();
|
|
||||||
Q_REQUIRED_RESULT qsizetype currentRow();
|
|
||||||
Q_REQUIRED_RESULT qsizetype currentColumn();
|
|
||||||
Q_REQUIRED_RESULT qsizetype currentOffset();
|
|
||||||
Q_REQUIRED_RESULT qsizetype selectedLength();
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QByteArray selectedBytes(qsizetype index);
|
|
||||||
Q_REQUIRED_RESULT QByteArrayList selectionBytes();
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT WingHex::HexPosition selectionStart(qsizetype index);
|
|
||||||
Q_REQUIRED_RESULT WingHex::HexPosition selectionEnd(qsizetype index);
|
|
||||||
Q_REQUIRED_RESULT qsizetype selectionLength(qsizetype index);
|
|
||||||
Q_REQUIRED_RESULT qsizetype selectionCount();
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT bool stringVisible();
|
|
||||||
Q_REQUIRED_RESULT bool addressVisible();
|
|
||||||
Q_REQUIRED_RESULT bool headerVisible();
|
|
||||||
Q_REQUIRED_RESULT quintptr addressBase();
|
|
||||||
Q_REQUIRED_RESULT bool isModified();
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT qint8 readInt8(qsizetype offset);
|
|
||||||
Q_REQUIRED_RESULT qint16 readInt16(qsizetype offset);
|
|
||||||
Q_REQUIRED_RESULT qint32 readInt32(qsizetype offset);
|
|
||||||
Q_REQUIRED_RESULT qint64 readInt64(qsizetype offset);
|
|
||||||
Q_REQUIRED_RESULT quint8 readUInt8(qsizetype offset);
|
|
||||||
Q_REQUIRED_RESULT quint16 readUInt16(qsizetype offset);
|
|
||||||
Q_REQUIRED_RESULT quint32 readUInt32(qsizetype offset);
|
|
||||||
Q_REQUIRED_RESULT quint64 readUInt64(qsizetype offset);
|
|
||||||
Q_REQUIRED_RESULT float readFloat(qsizetype offset);
|
|
||||||
Q_REQUIRED_RESULT double readDouble(qsizetype offset);
|
|
||||||
Q_REQUIRED_RESULT QString readString(qsizetype offset,
|
|
||||||
const QString &encoding = {});
|
|
||||||
Q_REQUIRED_RESULT QByteArray readBytes(qsizetype offset, qsizetype count);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT qsizetype findNext(qsizetype begin, const QByteArray &ba);
|
|
||||||
Q_REQUIRED_RESULT qsizetype findPrevious(qsizetype begin,
|
|
||||||
const QByteArray &ba);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QString bookMarkComment(qsizetype pos);
|
|
||||||
Q_REQUIRED_RESULT bool existBookMark(qsizetype pos);
|
|
||||||
|
|
||||||
public:
|
|
||||||
// document
|
|
||||||
Q_REQUIRED_RESULT bool switchDocument(int handle);
|
|
||||||
Q_REQUIRED_RESULT bool raiseDocument(int handle);
|
|
||||||
Q_REQUIRED_RESULT bool setLockedFile(bool b);
|
|
||||||
Q_REQUIRED_RESULT bool setKeepSize(bool b);
|
|
||||||
Q_REQUIRED_RESULT bool setStringVisible(bool b);
|
|
||||||
Q_REQUIRED_RESULT bool setAddressVisible(bool b);
|
|
||||||
Q_REQUIRED_RESULT bool setHeaderVisible(bool b);
|
|
||||||
Q_REQUIRED_RESULT bool setAddressBase(quintptr base);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT bool beginMarco(const QString &txt = {});
|
|
||||||
bool endMarco();
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT bool writeInt8(qsizetype offset, qint8 value);
|
|
||||||
Q_REQUIRED_RESULT bool writeInt16(qsizetype offset, qint16 value);
|
|
||||||
Q_REQUIRED_RESULT bool writeInt32(qsizetype offset, qint32 value);
|
|
||||||
Q_REQUIRED_RESULT bool writeInt64(qsizetype offset, qint64 value);
|
|
||||||
Q_REQUIRED_RESULT bool writeUInt8(qsizetype offset, quint8 value);
|
|
||||||
Q_REQUIRED_RESULT bool writeUInt16(qsizetype offset, quint16 value);
|
|
||||||
Q_REQUIRED_RESULT bool writeUInt32(qsizetype offset, quint32 value);
|
|
||||||
Q_REQUIRED_RESULT bool writeUInt64(qsizetype offset, quint64 value);
|
|
||||||
Q_REQUIRED_RESULT bool writeFloat(qsizetype offset, float value);
|
|
||||||
Q_REQUIRED_RESULT bool writeDouble(qsizetype offset, double value);
|
|
||||||
Q_REQUIRED_RESULT bool writeString(qsizetype offset, const QString &value,
|
|
||||||
const QString &encoding = QString());
|
|
||||||
Q_REQUIRED_RESULT bool writeBytes(qsizetype offset, const QByteArray &data);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT bool insertInt8(qsizetype offset, qint8 value);
|
|
||||||
Q_REQUIRED_RESULT bool insertInt16(qsizetype offset, qint16 value);
|
|
||||||
Q_REQUIRED_RESULT bool insertInt32(qsizetype offset, qint32 value);
|
|
||||||
Q_REQUIRED_RESULT bool insertInt64(qsizetype offset, qint64 value);
|
|
||||||
Q_REQUIRED_RESULT bool insertUInt8(qsizetype offset, quint8 value);
|
|
||||||
Q_REQUIRED_RESULT bool insertUInt16(qsizetype offset, quint16 value);
|
|
||||||
Q_REQUIRED_RESULT bool insertUInt32(qsizetype offset, quint32 value);
|
|
||||||
Q_REQUIRED_RESULT bool insertUInt64(qsizetype offset, quint64 value);
|
|
||||||
Q_REQUIRED_RESULT bool insertFloat(qsizetype offset, float value);
|
|
||||||
Q_REQUIRED_RESULT bool insertDouble(qsizetype offset, double value);
|
|
||||||
Q_REQUIRED_RESULT bool insertString(qsizetype offset, const QString &value,
|
|
||||||
const QString &encoding = QString());
|
|
||||||
Q_REQUIRED_RESULT bool insertBytes(qsizetype offset,
|
|
||||||
const QByteArray &data);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT bool appendInt8(qint8 value);
|
|
||||||
Q_REQUIRED_RESULT bool appendInt16(qint16 value);
|
|
||||||
Q_REQUIRED_RESULT bool appendInt32(qint32 value);
|
|
||||||
Q_REQUIRED_RESULT bool appendInt64(qint64 value);
|
|
||||||
Q_REQUIRED_RESULT bool appendUInt8(quint8 value);
|
|
||||||
Q_REQUIRED_RESULT bool appendUInt16(quint16 value);
|
|
||||||
Q_REQUIRED_RESULT bool appendUInt32(quint32 value);
|
|
||||||
Q_REQUIRED_RESULT bool appendUInt64(quint64 value);
|
|
||||||
Q_REQUIRED_RESULT bool appendFloat(float value);
|
|
||||||
Q_REQUIRED_RESULT bool appendDouble(double value);
|
|
||||||
Q_REQUIRED_RESULT bool appendString(const QString &value,
|
|
||||||
const QString &encoding = QString());
|
|
||||||
Q_REQUIRED_RESULT bool appendBytes(const QByteArray &data);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT bool removeBytes(qsizetype offset, qsizetype len);
|
|
||||||
|
|
||||||
// cursor
|
|
||||||
Q_REQUIRED_RESULT bool moveTo(qsizetype line, qsizetype column,
|
|
||||||
int nibbleindex = 1,
|
|
||||||
bool clearSelection = true);
|
|
||||||
Q_REQUIRED_RESULT bool moveTo(qsizetype offset, bool clearSelection = true);
|
|
||||||
Q_REQUIRED_RESULT bool select(qsizetype offset, qsizetype length,
|
|
||||||
SelectionMode mode = SelectionMode::Add);
|
|
||||||
Q_REQUIRED_RESULT bool setInsertionMode(bool isinsert);
|
|
||||||
|
|
||||||
// metadata
|
|
||||||
Q_REQUIRED_RESULT bool foreground(qsizetype begin, qsizetype length,
|
|
||||||
const QColor &fgcolor);
|
|
||||||
Q_REQUIRED_RESULT bool background(qsizetype begin, qsizetype length,
|
|
||||||
const QColor &bgcolor);
|
|
||||||
Q_REQUIRED_RESULT bool comment(qsizetype begin, qsizetype length,
|
|
||||||
const QString &comment);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT bool metadata(qsizetype begin, qsizetype length,
|
|
||||||
const QColor &fgcolor,
|
|
||||||
const QColor &bgcolor,
|
|
||||||
const QString &comment);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT bool removeMetadata(qsizetype offset);
|
|
||||||
Q_REQUIRED_RESULT bool clearMetadata();
|
|
||||||
Q_REQUIRED_RESULT bool setMetaVisible(bool b);
|
|
||||||
Q_REQUIRED_RESULT bool setMetafgVisible(bool b);
|
|
||||||
Q_REQUIRED_RESULT bool setMetabgVisible(bool b);
|
|
||||||
Q_REQUIRED_RESULT bool setMetaCommentVisible(bool b);
|
|
||||||
|
|
||||||
// mainwindow
|
|
||||||
Q_REQUIRED_RESULT WingHex::ErrFile newFile();
|
|
||||||
Q_REQUIRED_RESULT WingHex::ErrFile openFile(const QString &filename);
|
|
||||||
Q_REQUIRED_RESULT WingHex::ErrFile openExtFile(const QString &ext,
|
|
||||||
const QString &file);
|
|
||||||
|
|
||||||
WingHex::ErrFile closeHandle(int handle);
|
|
||||||
WingHex::ErrFile closeFile(int handle, bool force = false);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT WingHex::ErrFile saveFile(int handle);
|
|
||||||
Q_REQUIRED_RESULT WingHex::ErrFile exportFile(int handle,
|
|
||||||
const QString &savename);
|
|
||||||
Q_REQUIRED_RESULT WingHex::ErrFile saveAsFile(int handle,
|
|
||||||
const QString &savename);
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT WingHex::ErrFile openCurrent();
|
|
||||||
Q_REQUIRED_RESULT WingHex::ErrFile closeCurrent(bool force = false);
|
|
||||||
Q_REQUIRED_RESULT WingHex::ErrFile saveCurrent();
|
|
||||||
Q_REQUIRED_RESULT WingHex::ErrFile exportCurrent(const QString &savename);
|
|
||||||
Q_REQUIRED_RESULT WingHex::ErrFile saveAsCurrent(const QString &savename);
|
|
||||||
|
|
||||||
// bookmark
|
|
||||||
Q_REQUIRED_RESULT bool addBookMark(qsizetype pos, const QString &comment);
|
|
||||||
Q_REQUIRED_RESULT bool modBookMark(qsizetype pos, const QString &comment);
|
|
||||||
Q_REQUIRED_RESULT bool removeBookMark(qsizetype pos);
|
|
||||||
Q_REQUIRED_RESULT bool clearBookMark();
|
|
||||||
|
|
||||||
// workspace
|
|
||||||
Q_REQUIRED_RESULT WingHex::ErrFile openWorkSpace(const QString &filename);
|
|
||||||
|
|
||||||
// extension
|
|
||||||
bool closeAllFiles();
|
|
||||||
|
|
||||||
public:
|
|
||||||
bool dataVisualText(const QString &data, const QString &title = {});
|
|
||||||
bool dataVisualTextList(const QStringList &data, const QString &title = {},
|
|
||||||
WingHex::ClickedCallBack clicked = {},
|
|
||||||
WingHex::ClickedCallBack dblClicked = {});
|
|
||||||
|
|
||||||
Q_REQUIRED_RESULT bool
|
|
||||||
dataVisualTextTree(const QString &json, const QString &title = {},
|
|
||||||
WingHex::ClickedCallBack clicked = {},
|
|
||||||
WingHex::ClickedCallBack dblClicked = {});
|
|
||||||
Q_REQUIRED_RESULT bool
|
|
||||||
dataVisualTextTable(const QString &json, const QStringList &headers,
|
|
||||||
const QStringList &headerNames = {},
|
|
||||||
const QString &title = {},
|
|
||||||
WingHex::ClickedCallBack clicked = {},
|
|
||||||
WingHex::ClickedCallBack dblClicked = {});
|
|
||||||
|
|
||||||
// API for Qt Plugin Only
|
|
||||||
Q_REQUIRED_RESULT bool
|
|
||||||
dataVisualTextListByModel(QAbstractItemModel *model,
|
|
||||||
const QString &title = {},
|
|
||||||
WingHex::ClickedCallBack clicked = {},
|
|
||||||
WingHex::ClickedCallBack dblClicked = {});
|
|
||||||
Q_REQUIRED_RESULT bool
|
|
||||||
dataVisualTextTableByModel(QAbstractItemModel *model,
|
|
||||||
const QString &title = {},
|
|
||||||
WingHex::ClickedCallBack clicked = {},
|
|
||||||
WingHex::ClickedCallBack dblClicked = {});
|
|
||||||
Q_REQUIRED_RESULT bool
|
|
||||||
dataVisualTextTreeByModel(QAbstractItemModel *model,
|
|
||||||
const QString &title = {},
|
|
||||||
WingHex::ClickedCallBack clicked = {},
|
|
||||||
WingHex::ClickedCallBack dblClicked = {});
|
|
||||||
};
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT IWingPluginAPICalls : public IWingPluginCalls,
|
|
||||||
public IWingPluginBaseCalls {
|
|
||||||
public:
|
|
||||||
explicit IWingPluginAPICalls(IWingPlugin *const caller);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace WingHex
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(const char *)
|
|
||||||
Q_DECLARE_METATYPE(QGenericArgument)
|
|
||||||
Q_DECLARE_METATYPE(QGenericReturnArgument)
|
|
||||||
Q_DECLARE_METATYPE(QModelIndex)
|
|
||||||
Q_DECLARE_METATYPE(WingHex::ClickedCallBack)
|
|
||||||
Q_DECLARE_METATYPE(WingHex::HexPosition)
|
|
||||||
|
|
||||||
#endif // IWINGPLUGINCALLS_H
|
|
|
@ -1,29 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "settingpage.h"
|
|
||||||
|
|
||||||
using namespace WingHex;
|
|
||||||
|
|
||||||
PageBase::PageBase(QWidget *parent) : QWidget(parent) {}
|
|
||||||
|
|
||||||
SettingPage::SettingPage(QWidget *parent) : PageBase(parent) {}
|
|
||||||
|
|
||||||
PluginPage::PluginPage(QWidget *parent) : PageBase(parent) {}
|
|
|
@ -1,60 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SETTINGPAGE_H
|
|
||||||
#define SETTINGPAGE_H
|
|
||||||
|
|
||||||
#include "wingplugin_global.h"
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
namespace WingHex {
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT PageBase : public QWidget {
|
|
||||||
public:
|
|
||||||
explicit PageBase(QWidget *parent = nullptr);
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual QIcon categoryIcon() const = 0;
|
|
||||||
virtual QString name() const = 0;
|
|
||||||
virtual QString id() const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT SettingPage : public PageBase {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit SettingPage(QWidget *parent = nullptr);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void optionNeedRestartChanged();
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual void apply() = 0;
|
|
||||||
virtual void reset() = 0;
|
|
||||||
virtual void cancel() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT PluginPage : public PageBase {
|
|
||||||
public:
|
|
||||||
explicit PluginPage(QWidget *parent = nullptr);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace WingHex
|
|
||||||
|
|
||||||
#endif // SETTINGPAGE_H
|
|
|
@ -1,72 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef WINGCORE_H
|
|
||||||
#define WINGCORE_H
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QMetaType>
|
|
||||||
#include <QMutex>
|
|
||||||
#include <QMutexLocker>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
constexpr auto CALL_TABLE_PROPERTY = "__CALL_TABLE__";
|
|
||||||
constexpr auto CALL_POINTER_PROPERTY = "__CALL_POINTER__";
|
|
||||||
|
|
||||||
template <class Func>
|
|
||||||
inline QByteArray getFunctionSig(Func &&, const char *fn) {
|
|
||||||
typedef QtPrivate::FunctionPointer<std::decay_t<Func>> FnPointerType;
|
|
||||||
const int *types =
|
|
||||||
QtPrivate::ConnectionTypes<typename FnPointerType::Arguments>::types();
|
|
||||||
if constexpr (FnPointerType::ArgumentCount > 0) {
|
|
||||||
QStringList args;
|
|
||||||
Q_ASSERT(types);
|
|
||||||
for (int i = 0; i < FnPointerType::ArgumentCount; ++i) {
|
|
||||||
QMetaType type(types[i]);
|
|
||||||
if (type.isValid()) {
|
|
||||||
args.append(type.name());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return QByteArray(fn) + '(' + args.join(',').toLatin1() + ')';
|
|
||||||
} else {
|
|
||||||
return QByteArray(fn) + QByteArray("()");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SETUP_CALL_CONTEXT(FN) \
|
|
||||||
static QMutex __mutex__; \
|
|
||||||
static QMetaMethod m; \
|
|
||||||
do { \
|
|
||||||
QMutexLocker locker(&__mutex__); \
|
|
||||||
static auto CALLNAME = getFunctionSig(FN, __func__); \
|
|
||||||
if (!m.isValid()) { \
|
|
||||||
auto fnMap = callTable(); \
|
|
||||||
if (fnMap.contains(CALLNAME)) { \
|
|
||||||
m = fnMap.value(CALLNAME); \
|
|
||||||
Q_ASSERT(m.isValid()); \
|
|
||||||
} else { \
|
|
||||||
qDebug("[InvokeCall] '%s' is not found in call table.", \
|
|
||||||
CALLNAME.constData()); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#endif // WINGCORE_H
|
|
|
@ -1,53 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "wingeditorviewwidget.h"
|
|
||||||
|
|
||||||
WingHex::WingEditorViewWidget::WingEditorViewWidget(IWingPlugin *plg,
|
|
||||||
QWidget *parent)
|
|
||||||
: WingPluginWidget(plg, parent) {}
|
|
||||||
|
|
||||||
void WingHex::WingEditorViewWidget::raiseView() {
|
|
||||||
constexpr auto VIEW_PROPERTY = "__VIEW__";
|
|
||||||
constexpr auto VIEW_ID_PROPERTY = "__ID__";
|
|
||||||
|
|
||||||
auto rawptr =
|
|
||||||
reinterpret_cast<QObject *>(property(VIEW_PROPERTY).value<quintptr>());
|
|
||||||
auto ptr = qobject_cast<QWidget *>(rawptr);
|
|
||||||
auto id = property(VIEW_ID_PROPERTY).toString();
|
|
||||||
if (ptr && !id.isEmpty()) {
|
|
||||||
QMetaObject::invokeMethod(ptr, "raiseAndSwitchView",
|
|
||||||
Qt::DirectConnection, WINGAPI_ARG(id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WingHex::WingEditorViewWidget::loadState(const QByteArray &state) {
|
|
||||||
Q_UNUSED(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WingHex::WingEditorViewWidget::hasUnsavedState() { return false; }
|
|
||||||
|
|
||||||
QByteArray WingHex::WingEditorViewWidget::saveState() { return {}; }
|
|
||||||
|
|
||||||
bool WingHex::WingEditorViewWidget::onClosing() { return true; }
|
|
||||||
|
|
||||||
void WingHex::WingEditorViewWidget::onWorkSpaceNotify(bool isWorkSpace) {
|
|
||||||
Q_UNUSED(isWorkSpace);
|
|
||||||
}
|
|
|
@ -1,84 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef WINGEDITORVIEWWIDGET_H
|
|
||||||
#define WINGEDITORVIEWWIDGET_H
|
|
||||||
|
|
||||||
#include "WingPlugin/wingpluginwidget.h"
|
|
||||||
#include "iwingplugincalls.h"
|
|
||||||
#include "wingplugin_global.h"
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
namespace WingHex {
|
|
||||||
|
|
||||||
class IWingPlugin;
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT WingEditorViewWidget : public WingPluginWidget {
|
|
||||||
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
class Creator {
|
|
||||||
public:
|
|
||||||
Creator() = default;
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual QIcon icon() const = 0;
|
|
||||||
|
|
||||||
virtual QString name() const = 0;
|
|
||||||
|
|
||||||
virtual QString id() const = 0;
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual WingEditorViewWidget *create(WingHex::IWingPlugin *plg,
|
|
||||||
QWidget *parent) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit WingEditorViewWidget(WingHex::IWingPlugin *plg,
|
|
||||||
QWidget *parent = nullptr);
|
|
||||||
|
|
||||||
virtual WingEditorViewWidget *clone() = 0;
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void savedStateChanged(bool b);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void raiseView();
|
|
||||||
|
|
||||||
virtual void toggled(bool isVisible) = 0;
|
|
||||||
|
|
||||||
virtual void loadState(const QByteArray &state);
|
|
||||||
|
|
||||||
virtual bool hasUnsavedState();
|
|
||||||
|
|
||||||
virtual QByteArray saveState();
|
|
||||||
|
|
||||||
// return false then stop closing and swith the view
|
|
||||||
// but you cannot prevent closing the cloned view
|
|
||||||
virtual bool onClosing();
|
|
||||||
|
|
||||||
// cloned view will never call it
|
|
||||||
virtual void onWorkSpaceNotify(bool isWorkSpace);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace WingHex
|
|
||||||
|
|
||||||
#endif // WINGEDITORVIEWWIDGET_H
|
|
|
@ -1,130 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef WINGPLUGIN_GLOBAL_H
|
|
||||||
#define WINGPLUGIN_GLOBAL_H
|
|
||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
|
||||||
|
|
||||||
#if defined(WINGPLUGIN_LIBRARY)
|
|
||||||
#define WINGPLUGIN_EXPORT Q_DECL_EXPORT
|
|
||||||
#else
|
|
||||||
#define WINGPLUGIN_EXPORT Q_DECL_IMPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QInputDialog>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QMetaMethod>
|
|
||||||
#include <QString>
|
|
||||||
#include <QVersionNumber>
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
#ifdef WING_SERVICE
|
|
||||||
#undef WING_SERVICE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define WING_SERVICE Q_INVOKABLE
|
|
||||||
|
|
||||||
#define WINGAPI_ARG_SPEC(Type) \
|
|
||||||
inline QArgument<Type> WINGAPI_ARG(const Type &t) { \
|
|
||||||
return QArgument<Type>(QT_STRINGIFY(Type), t); \
|
|
||||||
} \
|
|
||||||
inline QReturnArgument<Type> WINGAPI_RETURN_ARG(Type &t) { \
|
|
||||||
return QReturnArgument<Type>(QT_STRINGIFY(Type), t); \
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
inline QArgument<T> WINGAPI_ARG(const T &t) {
|
|
||||||
static QByteArray name;
|
|
||||||
if (name.isEmpty()) {
|
|
||||||
auto m = QMetaType::fromType<std::decay_t<T>>();
|
|
||||||
name = m.name();
|
|
||||||
}
|
|
||||||
return QArgument<std::decay_t<T>>(name, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
inline QReturnArgument<T> WINGAPI_RETURN_ARG(T &t) {
|
|
||||||
static QByteArray name;
|
|
||||||
if (name.isEmpty()) {
|
|
||||||
auto m = QMetaType::fromType<std::decay_t<T>>();
|
|
||||||
name = m.name();
|
|
||||||
}
|
|
||||||
return QReturnArgument<std::decay_t<T>>(name, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace WingHex {
|
|
||||||
|
|
||||||
struct WingDockWidgetInfo {
|
|
||||||
QString widgetName;
|
|
||||||
QString displayName;
|
|
||||||
QWidget *widget = nullptr;
|
|
||||||
Qt::DockWidgetArea area = Qt::DockWidgetArea::NoDockWidgetArea;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct WingDependency {
|
|
||||||
QString puid;
|
|
||||||
QVersionNumber version;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class AppTheme { Dark, Light };
|
|
||||||
|
|
||||||
using CallTable = QHash<QByteArray, QMetaMethod>;
|
|
||||||
|
|
||||||
using ClickedCallBack = std::function<void(const QModelIndex &)>;
|
|
||||||
|
|
||||||
Q_NAMESPACE_EXPORT(WINGPLUGIN_EXPORT)
|
|
||||||
|
|
||||||
enum ErrFile : int {
|
|
||||||
Success = 0,
|
|
||||||
Error = -1,
|
|
||||||
UnSaved = -2,
|
|
||||||
Permission = -3,
|
|
||||||
NotExist = -4,
|
|
||||||
AlreadyOpened = -5,
|
|
||||||
IsNewFile = -6,
|
|
||||||
WorkSpaceUnSaved = -7,
|
|
||||||
ClonedFile = -8,
|
|
||||||
InvalidFormat = -9,
|
|
||||||
TooManyOpenedFile = -10,
|
|
||||||
NotAllowedInNoneGUIThread = -11,
|
|
||||||
DevNotFound = -12,
|
|
||||||
};
|
|
||||||
Q_ENUM_NS(ErrFile)
|
|
||||||
|
|
||||||
enum class SelectionMode : int { Add, Remove, Single };
|
|
||||||
Q_ENUM_NS(SelectionMode)
|
|
||||||
|
|
||||||
} // namespace WingHex
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(WingHex::AppTheme)
|
|
||||||
Q_DECLARE_METATYPE(WingHex::CallTable)
|
|
||||||
|
|
||||||
// Template specialization for typedefs
|
|
||||||
WINGAPI_ARG_SPEC(QMessageBox::StandardButtons);
|
|
||||||
WINGAPI_ARG_SPEC(QInputDialog::InputDialogOptions);
|
|
||||||
WINGAPI_ARG_SPEC(QFileDialog::Options);
|
|
||||||
WINGAPI_ARG_SPEC(Qt::InputMethodHints);
|
|
||||||
WINGAPI_ARG_SPEC(qsizetype);
|
|
||||||
|
|
||||||
WINGAPI_ARG_SPEC(WingHex::ClickedCallBack);
|
|
||||||
|
|
||||||
#endif // WINGPLUGIN_GLOBAL_H
|
|
|
@ -1,34 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "wingplugincallconvertor.h"
|
|
||||||
|
|
||||||
#include "WingPlugin/wingplugin_global.h"
|
|
||||||
#include "iwingpluginbase.h"
|
|
||||||
|
|
||||||
WingHex::WingPluginCallConvertor::WingPluginCallConvertor(QObject *caller) {
|
|
||||||
_caller = reinterpret_cast<WingHex::IWingPluginBase *>(caller);
|
|
||||||
Q_ASSERT(_caller);
|
|
||||||
}
|
|
||||||
|
|
||||||
QArgument<WingHex::IWingPluginBase *>
|
|
||||||
WingHex::WingPluginCallConvertor::getSenderObj() {
|
|
||||||
return WINGAPI_ARG(_caller);
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef WINGPLUGINCALLCONVERTOR_H
|
|
||||||
#define WINGPLUGINCALLCONVERTOR_H
|
|
||||||
|
|
||||||
#include <QArgument>
|
|
||||||
|
|
||||||
namespace WingHex {
|
|
||||||
|
|
||||||
class IWingPluginBase;
|
|
||||||
|
|
||||||
class WingPluginCallConvertor {
|
|
||||||
public:
|
|
||||||
WingPluginCallConvertor(QObject *caller);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QArgument<IWingPluginBase *> getSenderObj();
|
|
||||||
|
|
||||||
private:
|
|
||||||
IWingPluginBase *_caller;
|
|
||||||
};
|
|
||||||
} // namespace WingHex
|
|
||||||
|
|
||||||
#endif // WINGPLUGINCALLCONVERTOR_H
|
|
|
@ -1,109 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "wingplugincalls.h"
|
|
||||||
|
|
||||||
#include "wingcore.h"
|
|
||||||
#include "wingplugincalls_p.h"
|
|
||||||
|
|
||||||
#include <QDynamicPropertyChangeEvent>
|
|
||||||
#include <QEvent>
|
|
||||||
|
|
||||||
using namespace WingHex;
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QMetaMethod)
|
|
||||||
|
|
||||||
WingPluginCalls::WingPluginCalls(QObject *coreobj)
|
|
||||||
: WingPluginCallConvertor(coreobj), _core(new WingPluginCallsCore) {
|
|
||||||
Q_ASSERT(coreobj);
|
|
||||||
coreobj->installEventFilter(_core);
|
|
||||||
|
|
||||||
auto var = coreobj->property(CALL_POINTER_PROPERTY);
|
|
||||||
if (var.canConvert<quintptr>()) {
|
|
||||||
_core->d_ptr->_fnCaller =
|
|
||||||
reinterpret_cast<QObject *>(var.value<quintptr>());
|
|
||||||
}
|
|
||||||
|
|
||||||
var = coreobj->property(CALL_TABLE_PROPERTY);
|
|
||||||
if (var.canConvert<QHash<QByteArray, QMetaMethod>>()) {
|
|
||||||
_core->d_ptr->_fnTable = var.value<QHash<QByteArray, QMetaMethod>>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WingPluginCalls::~WingPluginCalls() { delete _core; }
|
|
||||||
|
|
||||||
WingHex::CallTable WingPluginCalls::callTable() const {
|
|
||||||
if (_core->d_ptr->_fnTable.isEmpty()) {
|
|
||||||
std::abort();
|
|
||||||
}
|
|
||||||
return _core->d_ptr->_fnTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject *WingPluginCalls::callReceiver() const {
|
|
||||||
if (_core->d_ptr->_fnCaller == nullptr) {
|
|
||||||
std::abort();
|
|
||||||
}
|
|
||||||
return _core->d_ptr->_fnCaller;
|
|
||||||
}
|
|
||||||
|
|
||||||
WingPluginCallsCore *WingPluginCalls::core() const { return _core; }
|
|
||||||
|
|
||||||
WingPluginCallsCore::WingPluginCallsCore()
|
|
||||||
: QObject(), d_ptr(new WingPluginCallsCorePrivate) {}
|
|
||||||
|
|
||||||
WingPluginCallsCore::~WingPluginCallsCore() { delete d_ptr; }
|
|
||||||
|
|
||||||
bool WingPluginCallsCore::eventFilter(QObject *watched, QEvent *event) {
|
|
||||||
if (event->type() == QEvent::DynamicPropertyChange) {
|
|
||||||
auto e = static_cast<QDynamicPropertyChangeEvent *>(event);
|
|
||||||
if (e) {
|
|
||||||
auto ppname = e->propertyName();
|
|
||||||
if (ppname == CALL_POINTER_PROPERTY) {
|
|
||||||
Q_D(WingPluginCallsCore);
|
|
||||||
if (d->_fnCaller) {
|
|
||||||
std::abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto var = watched->property(CALL_POINTER_PROPERTY);
|
|
||||||
if (!var.canConvert<quintptr>()) {
|
|
||||||
std::abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
d->_fnCaller =
|
|
||||||
reinterpret_cast<QObject *>(var.value<quintptr>());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ppname == CALL_TABLE_PROPERTY) {
|
|
||||||
Q_D(WingPluginCallsCore);
|
|
||||||
if (!d->_fnTable.isEmpty()) {
|
|
||||||
std::abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto var = watched->property(CALL_TABLE_PROPERTY);
|
|
||||||
if (!var.canConvert<QHash<QByteArray, QMetaMethod>>()) {
|
|
||||||
std::abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
d->_fnTable = var.value<QHash<QByteArray, QMetaMethod>>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return QObject::eventFilter(watched, event);
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef WINGPLUGINCALLS_H
|
|
||||||
#define WINGPLUGINCALLS_H
|
|
||||||
|
|
||||||
#include <QMetaMethod>
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
#include "wingplugin_global.h"
|
|
||||||
#include "wingplugincallconvertor.h"
|
|
||||||
|
|
||||||
namespace WingHex {
|
|
||||||
|
|
||||||
class WingPluginCallsCorePrivate;
|
|
||||||
|
|
||||||
class WingPluginCallsCore : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
friend class WingPluginCalls;
|
|
||||||
|
|
||||||
public:
|
|
||||||
WingPluginCallsCore();
|
|
||||||
virtual ~WingPluginCallsCore();
|
|
||||||
|
|
||||||
// QObject interface
|
|
||||||
public:
|
|
||||||
virtual bool eventFilter(QObject *watched, QEvent *event) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
WingPluginCallsCorePrivate *d_ptr;
|
|
||||||
Q_DECLARE_PRIVATE(WingPluginCallsCore)
|
|
||||||
Q_DISABLE_COPY_MOVE(WingPluginCallsCore)
|
|
||||||
};
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT WingPluginCalls : public WingPluginCallConvertor {
|
|
||||||
public:
|
|
||||||
explicit WingPluginCalls(QObject *coreobj);
|
|
||||||
virtual ~WingPluginCalls();
|
|
||||||
|
|
||||||
WingPluginCallsCore *core() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
WingHex::CallTable callTable() const;
|
|
||||||
|
|
||||||
QObject *callReceiver() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
WingPluginCallsCore *_core;
|
|
||||||
Q_DISABLE_COPY_MOVE(WingPluginCalls)
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace WingHex
|
|
||||||
|
|
||||||
#endif // WINGPLUGINCALLS_H
|
|
|
@ -1,40 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef WINGPLUGINCALLS_P_H
|
|
||||||
#define WINGPLUGINCALLS_P_H
|
|
||||||
|
|
||||||
#include <QHash>
|
|
||||||
#include <QMetaMethod>
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
#include "wingplugin_global.h"
|
|
||||||
|
|
||||||
namespace WingHex {
|
|
||||||
|
|
||||||
class WingPluginCallsCorePrivate {
|
|
||||||
public:
|
|
||||||
WingHex::CallTable _fnTable;
|
|
||||||
QObject *_fnCaller = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace WingHex
|
|
||||||
|
|
||||||
#endif // WINGPLUGINCALLS_P_H
|
|
|
@ -1,46 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "wingpluginwidget.h"
|
|
||||||
|
|
||||||
using namespace WingHex;
|
|
||||||
|
|
||||||
WingPluginWidget::WingPluginWidget(IWingPlugin *plg, QWidget *parent)
|
|
||||||
: QWidget(parent), WingHex::IWingPluginAPICalls(plg) {}
|
|
||||||
|
|
||||||
WingPluginWidget::~WingPluginWidget() {}
|
|
||||||
|
|
||||||
WingPluginDialog::WingPluginDialog(IWingPlugin *plg, QWidget *parent)
|
|
||||||
: QDialog(parent), WingHex::IWingPluginAPICalls(plg) {}
|
|
||||||
|
|
||||||
WingPluginDialog::~WingPluginDialog() {}
|
|
||||||
|
|
||||||
WingPluginWindow::WingPluginWindow(IWingPlugin *plg, QWindow *parent)
|
|
||||||
: QWindow(parent), WingHex::IWingPluginAPICalls(plg) {}
|
|
||||||
|
|
||||||
WingPluginWindow::WingPluginWindow(IWingPlugin *plg, QScreen *parent)
|
|
||||||
: QWindow(parent), WingHex::IWingPluginAPICalls(plg) {}
|
|
||||||
|
|
||||||
WingPluginWindow::~WingPluginWindow() {}
|
|
||||||
|
|
||||||
WingPluginMainWindow::WingPluginMainWindow(IWingPlugin *plg, QWidget *parent)
|
|
||||||
: QMainWindow(parent), WingHex::IWingPluginAPICalls(plg) {}
|
|
||||||
|
|
||||||
WingPluginMainWindow::~WingPluginMainWindow() {}
|
|
|
@ -1,84 +0,0 @@
|
||||||
/*==============================================================================
|
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
|
||||||
**
|
|
||||||
** You can redistribute this file and/or modify it under the terms of the
|
|
||||||
** BSD 3-Clause.
|
|
||||||
**
|
|
||||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
** POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef WINGPLUGINWIDGET_H
|
|
||||||
#define WINGPLUGINWIDGET_H
|
|
||||||
|
|
||||||
#include "WingPlugin/iwingplugincalls.h"
|
|
||||||
#include "wingplugin_global.h"
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QWindow>
|
|
||||||
|
|
||||||
namespace WingHex {
|
|
||||||
|
|
||||||
class IWingPlugin;
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT WingPluginWidget
|
|
||||||
: public QWidget,
|
|
||||||
protected WingHex::IWingPluginAPICalls {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit WingPluginWidget(WingHex::IWingPlugin *plg,
|
|
||||||
QWidget *parent = nullptr);
|
|
||||||
virtual ~WingPluginWidget();
|
|
||||||
};
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT WingPluginDialog
|
|
||||||
: public QDialog,
|
|
||||||
protected WingHex::IWingPluginAPICalls {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit WingPluginDialog(WingHex::IWingPlugin *plg,
|
|
||||||
QWidget *parent = nullptr);
|
|
||||||
virtual ~WingPluginDialog();
|
|
||||||
};
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT WingPluginWindow
|
|
||||||
: public QWindow,
|
|
||||||
protected WingHex::IWingPluginAPICalls {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit WingPluginWindow(WingHex::IWingPlugin *plg,
|
|
||||||
QWindow *parent = nullptr);
|
|
||||||
explicit WingPluginWindow(WingHex::IWingPlugin *plg,
|
|
||||||
QScreen *parent = nullptr);
|
|
||||||
virtual ~WingPluginWindow();
|
|
||||||
};
|
|
||||||
|
|
||||||
class WINGPLUGIN_EXPORT WingPluginMainWindow
|
|
||||||
: public QMainWindow,
|
|
||||||
protected WingHex::IWingPluginAPICalls {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit WingPluginMainWindow(WingHex::IWingPlugin *plg,
|
|
||||||
QWidget *parent = nullptr);
|
|
||||||
virtual ~WingPluginMainWindow();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace WingHex
|
|
||||||
|
|
||||||
#endif // WINGPLUGINWIDGET_H
|
|
|
@ -211,6 +211,54 @@
|
||||||
<translation>代码格式化样式出现错误,你确认继续修改吗?</translation>
|
<translation>代码格式化样式出现错误,你确认继续修改吗?</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>CodeEdit</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="253"/>
|
||||||
|
<source>Copy</source>
|
||||||
|
<translation>复制</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="255"/>
|
||||||
|
<source>Cut</source>
|
||||||
|
<translation>剪切</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="257"/>
|
||||||
|
<source>Paste</source>
|
||||||
|
<translation>粘贴</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="261"/>
|
||||||
|
<source>Find</source>
|
||||||
|
<translation>查找</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="265"/>
|
||||||
|
<source>Replace</source>
|
||||||
|
<translation>替换</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="268"/>
|
||||||
|
<source>Goto</source>
|
||||||
|
<translation>跳转</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="273"/>
|
||||||
|
<source>Comment/UnComment</source>
|
||||||
|
<translation>注释/取消注释</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="318"/>
|
||||||
|
<source>Fold/UnFold</source>
|
||||||
|
<translation>折叠/展开</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="325"/>
|
||||||
|
<source>FoldAll</source>
|
||||||
|
<translation>折叠所有</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ColorPickerDialog</name>
|
<name>ColorPickerDialog</name>
|
||||||
<message>
|
<message>
|
||||||
|
@ -309,12 +357,12 @@
|
||||||
<context>
|
<context>
|
||||||
<name>DockWidgetTab</name>
|
<name>DockWidgetTab</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/dockwidgettab.cpp" line="24"/>
|
<location filename="../../src/control/dockwidgettab.cpp" line="41"/>
|
||||||
<source>FileInfo</source>
|
<source>FileInfo</source>
|
||||||
<translation>文件信息</translation>
|
<translation>文件信息</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/dockwidgettab.cpp" line="47"/>
|
<location filename="../../src/control/dockwidgettab.cpp" line="64"/>
|
||||||
<source>ShowInShell</source>
|
<source>ShowInShell</source>
|
||||||
<translation>显示包含目录</translation>
|
<translation>显示包含目录</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -2478,32 +2526,37 @@
|
||||||
<translation>选项</translation>
|
<translation>选项</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.ui" line="155"/>
|
<location filename="../../src/settings/qeditconfig.ui" line="195"/>
|
||||||
<source>LineNumber</source>
|
<source>LineNumber</source>
|
||||||
<translation>行号</translation>
|
<translation>行号</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.ui" line="165"/>
|
<location filename="../../src/settings/qeditconfig.ui" line="205"/>
|
||||||
<source>WordWrap</source>
|
<source>WordWrap</source>
|
||||||
<translation>换行</translation>
|
<translation>换行</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.ui" line="175"/>
|
<location filename="../../src/settings/qeditconfig.ui" line="235"/>
|
||||||
|
<source>AutoIden</source>
|
||||||
|
<translation>自动缩进</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/settings/qeditconfig.ui" line="185"/>
|
||||||
<source>Whitespace</source>
|
<source>Whitespace</source>
|
||||||
<translation>空格可见</translation>
|
<translation>空格可见</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.ui" line="185"/>
|
<location filename="../../src/settings/qeditconfig.ui" line="165"/>
|
||||||
<source>AutoCloseChar</source>
|
<source>AutoCloseChar</source>
|
||||||
<translation>匹配填充</translation>
|
<translation>匹配填充</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.ui" line="195"/>
|
<location filename="../../src/settings/qeditconfig.ui" line="155"/>
|
||||||
<source>MatchBraces</source>
|
<source>MatchBraces</source>
|
||||||
<translation>高亮括号</translation>
|
<translation>高亮括号</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.ui" line="205"/>
|
<location filename="../../src/settings/qeditconfig.ui" line="175"/>
|
||||||
<source>Folding</source>
|
<source>Folding</source>
|
||||||
<translation>代码折叠</translation>
|
<translation>代码折叠</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -2523,32 +2576,32 @@
|
||||||
<translation>制表符宽度</translation>
|
<translation>制表符宽度</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.cpp" line="291"/>
|
<location filename="../../src/settings/qeditconfig.cpp" line="295"/>
|
||||||
<source>Default</source>
|
<source>Default</source>
|
||||||
<translation>默认</translation>
|
<translation>默认</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.cpp" line="303"/>
|
<location filename="../../src/settings/qeditconfig.cpp" line="307"/>
|
||||||
<source>IndentMixed</source>
|
<source>IndentMixed</source>
|
||||||
<translation>混合缩进</translation>
|
<translation>混合缩进</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.cpp" line="300"/>
|
<location filename="../../src/settings/qeditconfig.cpp" line="304"/>
|
||||||
<source>IndentSpaces</source>
|
<source>IndentSpaces</source>
|
||||||
<translation>空格缩进</translation>
|
<translation>空格缩进</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.cpp" line="163"/>
|
<location filename="../../src/settings/qeditconfig.cpp" line="166"/>
|
||||||
<source>Console</source>
|
<source>Console</source>
|
||||||
<translation>控制台</translation>
|
<translation>控制台</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.cpp" line="301"/>
|
<location filename="../../src/settings/qeditconfig.cpp" line="305"/>
|
||||||
<source>IndentTabs</source>
|
<source>IndentTabs</source>
|
||||||
<translation>制表符缩进</translation>
|
<translation>制表符缩进</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.cpp" line="167"/>
|
<location filename="../../src/settings/qeditconfig.cpp" line="170"/>
|
||||||
<source>Edit</source>
|
<source>Edit</source>
|
||||||
<translation>编辑</translation>
|
<translation>编辑</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -4432,25 +4485,40 @@
|
||||||
<context>
|
<context>
|
||||||
<name>ScriptingConsole</name>
|
<name>ScriptingConsole</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/scriptingconsole.cpp" line="89"/>
|
<location filename="../../src/control/scriptingconsole.cpp" line="142"/>
|
||||||
<source>[Info]</source>
|
<source>[Info]</source>
|
||||||
<translation>【信息】</translation>
|
<translation>【信息】</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/scriptingconsole.cpp" line="97"/>
|
<location filename="../../src/control/scriptingconsole.cpp" line="153"/>
|
||||||
<source>[Warn]</source>
|
<source>[Warn]</source>
|
||||||
<translation>【警告】</translation>
|
<translation>【警告】</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/scriptingconsole.cpp" line="105"/>
|
<location filename="../../src/control/scriptingconsole.cpp" line="164"/>
|
||||||
<source>[Error]</source>
|
<source>[Error]</source>
|
||||||
<translation>【错误】</translation>
|
<translation>【错误】</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/scriptingconsole.cpp" line="198"/>
|
<location filename="../../src/control/scriptingconsole.cpp" line="263"/>
|
||||||
<source>[Console]</source>
|
<source>[Console]</source>
|
||||||
<translation>【控制台】</translation>
|
<translation>【控制台】</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/scriptingconsole.cpp" line="300"/>
|
||||||
|
<source>Copy</source>
|
||||||
|
<translation>复制</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/scriptingconsole.cpp" line="303"/>
|
||||||
|
<source>Cut</source>
|
||||||
|
<translation>剪切</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/scriptingconsole.cpp" line="306"/>
|
||||||
|
<source>Paste</source>
|
||||||
|
<translation>粘贴</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ScriptingConsoleBase</name>
|
<name>ScriptingConsoleBase</name>
|
||||||
|
@ -4701,11 +4769,11 @@
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="687"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="687"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="933"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="940"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1115"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1141"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1152"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1178"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1172"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1198"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1200"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1226"/>
|
||||||
<source>Error</source>
|
<source>Error</source>
|
||||||
<translation>错误</translation>
|
<translation>错误</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -4725,68 +4793,78 @@
|
||||||
<translation>脚本保存失败,你仍确认关闭吗?</translation>
|
<translation>脚本保存失败,你仍确认关闭吗?</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="892"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="899"/>
|
||||||
<source>Debuging...</source>
|
<source>Debuging...</source>
|
||||||
<translation>调试中...</translation>
|
<translation>调试中...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="895"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="902"/>
|
||||||
<source>Running...</source>
|
<source>Running...</source>
|
||||||
<translation>运行中...</translation>
|
<translation>运行中...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1088"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1100"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1131"/>
|
<source>Line %1, Col %2</source>
|
||||||
|
<translation>行 %1, 列 %2</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1102"/>
|
||||||
|
<source> (Selected: %1)</source>
|
||||||
|
<translation> (选中: %1)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1114"/>
|
||||||
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1157"/>
|
||||||
<source>ChooseFile</source>
|
<source>ChooseFile</source>
|
||||||
<translation>选择文件</translation>
|
<translation>选择文件</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="933"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="940"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1115"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1141"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1172"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1198"/>
|
||||||
<source>FilePermission</source>
|
<source>FilePermission</source>
|
||||||
<translation>因文件权限无法继续!</translation>
|
<translation>因文件权限无法继续!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1150"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1176"/>
|
||||||
<source>ReloadSuccessfully</source>
|
<source>ReloadSuccessfully</source>
|
||||||
<translation>文件重新加载成功!</translation>
|
<translation>文件重新加载成功!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1152"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1178"/>
|
||||||
<source>ReloadUnSuccessfully</source>
|
<source>ReloadUnSuccessfully</source>
|
||||||
<translation>文件重新加载失败!</translation>
|
<translation>文件重新加载失败!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1189"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1215"/>
|
||||||
<source>ChooseSaveFile</source>
|
<source>ChooseSaveFile</source>
|
||||||
<translation>请选择保存文件路径:</translation>
|
<translation>请选择保存文件路径:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1170"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1196"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1198"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1224"/>
|
||||||
<source>SaveSuccessfully</source>
|
<source>SaveSuccessfully</source>
|
||||||
<translation>保存成功!</translation>
|
<translation>保存成功!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1200"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1226"/>
|
||||||
<source>SaveUnSuccessfully</source>
|
<source>SaveUnSuccessfully</source>
|
||||||
<translation>保存失败!</translation>
|
<translation>保存失败!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1276"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1302"/>
|
||||||
<source>FormatCodeFailed</source>
|
<source>FormatCodeFailed</source>
|
||||||
<translation>代码格式化失败</translation>
|
<translation>代码格式化失败</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1325"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1351"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1343"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1369"/>
|
||||||
<source>CannotSave2RunScript</source>
|
<source>CannotSave2RunScript</source>
|
||||||
<translation>无法保存,故无法继续运行脚本。</translation>
|
<translation>无法保存,故无法继续运行脚本。</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="734"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="734"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1403"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1429"/>
|
||||||
<source>ScriptStillRunning</source>
|
<source>ScriptStillRunning</source>
|
||||||
<translation>脚本仍在运行,你确定要退出吗?</translation>
|
<translation>脚本仍在运行,你确定要退出吗?</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -5071,12 +5149,12 @@
|
||||||
<context>
|
<context>
|
||||||
<name>SkinManager</name>
|
<name>SkinManager</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/class/skinmanager.cpp" line="78"/>
|
<location filename="../../src/class/skinmanager.cpp" line="79"/>
|
||||||
<source>Dark</source>
|
<source>Dark</source>
|
||||||
<translation>暗黑</translation>
|
<translation>暗黑</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/class/skinmanager.cpp" line="79"/>
|
<location filename="../../src/class/skinmanager.cpp" line="80"/>
|
||||||
<source>Light</source>
|
<source>Light</source>
|
||||||
<translation>浅色</translation>
|
<translation>浅色</translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
|
@ -211,6 +211,54 @@
|
||||||
<translation>代碼格式化樣式出現錯誤,你確認繼續修改嗎?</translation>
|
<translation>代碼格式化樣式出現錯誤,你確認繼續修改嗎?</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>CodeEdit</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="253"/>
|
||||||
|
<source>Copy</source>
|
||||||
|
<translation>複製</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="255"/>
|
||||||
|
<source>Cut</source>
|
||||||
|
<translation>剪切</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="257"/>
|
||||||
|
<source>Paste</source>
|
||||||
|
<translation>粘貼</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="261"/>
|
||||||
|
<source>Find</source>
|
||||||
|
<translation>查找</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="265"/>
|
||||||
|
<source>Replace</source>
|
||||||
|
<translation>替換</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="268"/>
|
||||||
|
<source>Goto</source>
|
||||||
|
<translation>跳轉</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="273"/>
|
||||||
|
<source>Comment/UnComment</source>
|
||||||
|
<translation>注釋/取消注釋</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="318"/>
|
||||||
|
<source>Fold/UnFold</source>
|
||||||
|
<translation>折疊/展開</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/codeedit.cpp" line="325"/>
|
||||||
|
<source>FoldAll</source>
|
||||||
|
<translation>折疊所有</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ColorPickerDialog</name>
|
<name>ColorPickerDialog</name>
|
||||||
<message>
|
<message>
|
||||||
|
@ -309,12 +357,12 @@
|
||||||
<context>
|
<context>
|
||||||
<name>DockWidgetTab</name>
|
<name>DockWidgetTab</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/dockwidgettab.cpp" line="24"/>
|
<location filename="../../src/control/dockwidgettab.cpp" line="41"/>
|
||||||
<source>FileInfo</source>
|
<source>FileInfo</source>
|
||||||
<translation>檔資訊</translation>
|
<translation>檔資訊</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/dockwidgettab.cpp" line="47"/>
|
<location filename="../../src/control/dockwidgettab.cpp" line="64"/>
|
||||||
<source>ShowInShell</source>
|
<source>ShowInShell</source>
|
||||||
<translation>顯示包含目錄</translation>
|
<translation>顯示包含目錄</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -2478,32 +2526,37 @@
|
||||||
<translation>選項</translation>
|
<translation>選項</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.ui" line="155"/>
|
<location filename="../../src/settings/qeditconfig.ui" line="195"/>
|
||||||
<source>LineNumber</source>
|
<source>LineNumber</source>
|
||||||
<translation>行號</translation>
|
<translation>行號</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.ui" line="165"/>
|
<location filename="../../src/settings/qeditconfig.ui" line="205"/>
|
||||||
<source>WordWrap</source>
|
<source>WordWrap</source>
|
||||||
<translation>換行</translation>
|
<translation>換行</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.ui" line="175"/>
|
<location filename="../../src/settings/qeditconfig.ui" line="235"/>
|
||||||
|
<source>AutoIden</source>
|
||||||
|
<translation>自動縮進</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/settings/qeditconfig.ui" line="185"/>
|
||||||
<source>Whitespace</source>
|
<source>Whitespace</source>
|
||||||
<translation>空格可見</translation>
|
<translation>空格可見</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.ui" line="185"/>
|
<location filename="../../src/settings/qeditconfig.ui" line="165"/>
|
||||||
<source>AutoCloseChar</source>
|
<source>AutoCloseChar</source>
|
||||||
<translation>匹配填充</translation>
|
<translation>匹配填充</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.ui" line="195"/>
|
<location filename="../../src/settings/qeditconfig.ui" line="155"/>
|
||||||
<source>MatchBraces</source>
|
<source>MatchBraces</source>
|
||||||
<translation>括號匹配</translation>
|
<translation>括號匹配</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.ui" line="205"/>
|
<location filename="../../src/settings/qeditconfig.ui" line="175"/>
|
||||||
<source>Folding</source>
|
<source>Folding</source>
|
||||||
<translation>代碼折疊</translation>
|
<translation>代碼折疊</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -2523,32 +2576,32 @@
|
||||||
<translation>跳位字元寬度</translation>
|
<translation>跳位字元寬度</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.cpp" line="291"/>
|
<location filename="../../src/settings/qeditconfig.cpp" line="295"/>
|
||||||
<source>Default</source>
|
<source>Default</source>
|
||||||
<translation>默認</translation>
|
<translation>默認</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.cpp" line="303"/>
|
<location filename="../../src/settings/qeditconfig.cpp" line="307"/>
|
||||||
<source>IndentMixed</source>
|
<source>IndentMixed</source>
|
||||||
<translation>混合縮進</translation>
|
<translation>混合縮進</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.cpp" line="300"/>
|
<location filename="../../src/settings/qeditconfig.cpp" line="304"/>
|
||||||
<source>IndentSpaces</source>
|
<source>IndentSpaces</source>
|
||||||
<translation>空格縮進</translation>
|
<translation>空格縮進</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.cpp" line="163"/>
|
<location filename="../../src/settings/qeditconfig.cpp" line="166"/>
|
||||||
<source>Console</source>
|
<source>Console</source>
|
||||||
<translation>控制台</translation>
|
<translation>控制台</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.cpp" line="301"/>
|
<location filename="../../src/settings/qeditconfig.cpp" line="305"/>
|
||||||
<source>IndentTabs</source>
|
<source>IndentTabs</source>
|
||||||
<translation>定位字元縮進</translation>
|
<translation>定位字元縮進</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings/qeditconfig.cpp" line="167"/>
|
<location filename="../../src/settings/qeditconfig.cpp" line="170"/>
|
||||||
<source>Edit</source>
|
<source>Edit</source>
|
||||||
<translation>編輯</translation>
|
<translation>編輯</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -4432,25 +4485,40 @@
|
||||||
<context>
|
<context>
|
||||||
<name>ScriptingConsole</name>
|
<name>ScriptingConsole</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/scriptingconsole.cpp" line="89"/>
|
<location filename="../../src/control/scriptingconsole.cpp" line="142"/>
|
||||||
<source>[Info]</source>
|
<source>[Info]</source>
|
||||||
<translation>【資訊】</translation>
|
<translation>【資訊】</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/scriptingconsole.cpp" line="97"/>
|
<location filename="../../src/control/scriptingconsole.cpp" line="153"/>
|
||||||
<source>[Warn]</source>
|
<source>[Warn]</source>
|
||||||
<translation>【警告】</translation>
|
<translation>【警告】</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/scriptingconsole.cpp" line="105"/>
|
<location filename="../../src/control/scriptingconsole.cpp" line="164"/>
|
||||||
<source>[Error]</source>
|
<source>[Error]</source>
|
||||||
<translation>【錯誤】</translation>
|
<translation>【錯誤】</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/scriptingconsole.cpp" line="198"/>
|
<location filename="../../src/control/scriptingconsole.cpp" line="263"/>
|
||||||
<source>[Console]</source>
|
<source>[Console]</source>
|
||||||
<translation>【控制臺】</translation>
|
<translation>【控制臺】</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/scriptingconsole.cpp" line="300"/>
|
||||||
|
<source>Copy</source>
|
||||||
|
<translation>複製</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/scriptingconsole.cpp" line="303"/>
|
||||||
|
<source>Cut</source>
|
||||||
|
<translation>剪切</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/control/scriptingconsole.cpp" line="306"/>
|
||||||
|
<source>Paste</source>
|
||||||
|
<translation>粘貼</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ScriptingConsoleBase</name>
|
<name>ScriptingConsoleBase</name>
|
||||||
|
@ -4701,11 +4769,11 @@
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="687"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="687"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="933"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="940"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1115"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1141"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1152"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1178"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1172"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1198"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1200"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1226"/>
|
||||||
<source>Error</source>
|
<source>Error</source>
|
||||||
<translation>錯誤</translation>
|
<translation>錯誤</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -4725,68 +4793,78 @@
|
||||||
<translation>腳本保存失敗,你仍確認關閉嗎?</translation>
|
<translation>腳本保存失敗,你仍確認關閉嗎?</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="892"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="899"/>
|
||||||
<source>Debuging...</source>
|
<source>Debuging...</source>
|
||||||
<translation>調試中...</translation>
|
<translation>調試中...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="895"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="902"/>
|
||||||
<source>Running...</source>
|
<source>Running...</source>
|
||||||
<translation>運行中...</translation>
|
<translation>運行中...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1088"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1100"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1131"/>
|
<source>Line %1, Col %2</source>
|
||||||
|
<translation>行 %1, 列 %2</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1102"/>
|
||||||
|
<source> (Selected: %1)</source>
|
||||||
|
<translation> (選中: %1)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1114"/>
|
||||||
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1157"/>
|
||||||
<source>ChooseFile</source>
|
<source>ChooseFile</source>
|
||||||
<translation>選擇檔</translation>
|
<translation>選擇檔</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="933"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="940"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1115"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1141"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1172"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1198"/>
|
||||||
<source>FilePermission</source>
|
<source>FilePermission</source>
|
||||||
<translation>因檔許可權無法繼續!</translation>
|
<translation>因檔許可權無法繼續!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1150"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1176"/>
|
||||||
<source>ReloadSuccessfully</source>
|
<source>ReloadSuccessfully</source>
|
||||||
<translation>檔重新加載成功!</translation>
|
<translation>檔重新加載成功!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1152"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1178"/>
|
||||||
<source>ReloadUnSuccessfully</source>
|
<source>ReloadUnSuccessfully</source>
|
||||||
<translation>檔重新加載失敗!</translation>
|
<translation>檔重新加載失敗!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1189"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1215"/>
|
||||||
<source>ChooseSaveFile</source>
|
<source>ChooseSaveFile</source>
|
||||||
<translation>請選擇保存檔路徑:</translation>
|
<translation>請選擇保存檔路徑:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1170"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1196"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1198"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1224"/>
|
||||||
<source>SaveSuccessfully</source>
|
<source>SaveSuccessfully</source>
|
||||||
<translation>保存成功!</translation>
|
<translation>保存成功!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1200"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1226"/>
|
||||||
<source>SaveUnSuccessfully</source>
|
<source>SaveUnSuccessfully</source>
|
||||||
<translation>保存失敗!</translation>
|
<translation>保存失敗!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1276"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1302"/>
|
||||||
<source>FormatCodeFailed</source>
|
<source>FormatCodeFailed</source>
|
||||||
<translation>代碼格式化失敗</translation>
|
<translation>代碼格式化失敗</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1325"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1351"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1343"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1369"/>
|
||||||
<source>CannotSave2RunScript</source>
|
<source>CannotSave2RunScript</source>
|
||||||
<translation>無法保存,故無法繼續運行腳本。</translation>
|
<translation>無法保存,故無法繼續運行腳本。</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="734"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="734"/>
|
||||||
<location filename="../../src/dialog/scriptingdialog.cpp" line="1403"/>
|
<location filename="../../src/dialog/scriptingdialog.cpp" line="1429"/>
|
||||||
<source>ScriptStillRunning</source>
|
<source>ScriptStillRunning</source>
|
||||||
<translation>腳本仍在運行,你確定要退出嗎?</translation>
|
<translation>腳本仍在運行,你確定要退出嗎?</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -5071,12 +5149,12 @@
|
||||||
<context>
|
<context>
|
||||||
<name>SkinManager</name>
|
<name>SkinManager</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/class/skinmanager.cpp" line="78"/>
|
<location filename="../../src/class/skinmanager.cpp" line="79"/>
|
||||||
<source>Dark</source>
|
<source>Dark</source>
|
||||||
<translation>暗黑</translation>
|
<translation>暗黑</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/class/skinmanager.cpp" line="79"/>
|
<location filename="../../src/class/skinmanager.cpp" line="80"/>
|
||||||
<source>Light</source>
|
<source>Light</source>
|
||||||
<translation>淺色</translation>
|
<translation>淺色</translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
|
@ -646,11 +646,11 @@ QString ScriptMachine::processTranslation(const char *content,
|
||||||
return tr("Can't implicitly convert from '%1' to '%2'.")
|
return tr("Can't implicitly convert from '%1' to '%2'.")
|
||||||
.arg(contents.at(1), contents.at(2));
|
.arg(contents.at(1), contents.at(2));
|
||||||
}},
|
}},
|
||||||
{QRegularExpression(QStringLiteral("^Compiling (.*?)")),
|
{QRegularExpression(QStringLiteral("^Compiling (.*)")),
|
||||||
[](const QStringList &contents) -> QString {
|
[](const QStringList &contents) -> QString {
|
||||||
return tr("Compiling %1").arg(contents.at(1));
|
return tr("Compiling %1").arg(contents.at(1));
|
||||||
}},
|
}},
|
||||||
{QRegularExpression(QStringLiteral("^Compiling auto generated (.*?)")),
|
{QRegularExpression(QStringLiteral("^Compiling auto generated (.*)")),
|
||||||
[](const QStringList &contents) -> QString {
|
[](const QStringList &contents) -> QString {
|
||||||
return tr("Compiling auto generated %1").arg(contents.at(1));
|
return tr("Compiling auto generated %1").arg(contents.at(1));
|
||||||
}},
|
}},
|
||||||
|
@ -1805,7 +1805,7 @@ bool ScriptMachine::executeCode(const QString &code) {
|
||||||
_engine->GarbageCollect();
|
_engine->GarbageCollect();
|
||||||
|
|
||||||
// Release all contexts that have been allocated
|
// Release all contexts that have been allocated
|
||||||
for (auto ctx : _ctxPool) {
|
for (auto ctx : std::as_const(_ctxPool)) {
|
||||||
ctx->Release();
|
ctx->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QString, CODEEDIT_SHOW_WHITESPACE,
|
||||||
("codeedit.whitespace"))
|
("codeedit.whitespace"))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(QString, CODEEDIT_AUTO_CLOSE_CHAR,
|
Q_GLOBAL_STATIC_WITH_ARGS(QString, CODEEDIT_AUTO_CLOSE_CHAR,
|
||||||
("codeedit.auto_close_char"))
|
("codeedit.auto_close_char"))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(QString, CODEEDIT_AUTO_IDEN, ("codeedit.auto_iden"))
|
||||||
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(QString, CONSOLE_FONT, ("console.font"))
|
Q_GLOBAL_STATIC_WITH_ARGS(QString, CONSOLE_FONT, ("console.font"))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(QString, CONSOLE_FONT_SIZE, ("console.fontsize"))
|
Q_GLOBAL_STATIC_WITH_ARGS(QString, CONSOLE_FONT_SIZE, ("console.fontsize"))
|
||||||
|
@ -125,6 +126,7 @@ void ScriptSettings::load() {
|
||||||
READ_CONFIG_BOOL(m_editorFolding, CODEEDIT_SHOW_FOLDING, true);
|
READ_CONFIG_BOOL(m_editorFolding, CODEEDIT_SHOW_FOLDING, true);
|
||||||
READ_CONFIG_BOOL(m_editorShowGuideLine, CODEEDIT_SHOW_INDENTGUIDES, true);
|
READ_CONFIG_BOOL(m_editorShowGuideLine, CODEEDIT_SHOW_INDENTGUIDES, true);
|
||||||
READ_CONFIG_BOOL(m_editorShowLineEdges, CODEEDIT_SHOW_LONGLINEEDGE, false);
|
READ_CONFIG_BOOL(m_editorShowLineEdges, CODEEDIT_SHOW_LONGLINEEDGE, false);
|
||||||
|
READ_CONFIG_BOOL(m_editorAutoIden, CODEEDIT_AUTO_IDEN, true);
|
||||||
|
|
||||||
READ_CONFIG_BOOL(m_editorShowWhiteSpace, CODEEDIT_SHOW_WHITESPACE, false);
|
READ_CONFIG_BOOL(m_editorShowWhiteSpace, CODEEDIT_SHOW_WHITESPACE, false);
|
||||||
READ_CONFIG_BOOL(m_consoleShowWhiteSpace, CONSOLE_SHOW_WHITESPACE, false);
|
READ_CONFIG_BOOL(m_consoleShowWhiteSpace, CONSOLE_SHOW_WHITESPACE, false);
|
||||||
|
@ -168,6 +170,8 @@ void ScriptSettings::save(SETTINGS cat) {
|
||||||
WRITE_CONFIG_EDITOR_SET(CODEEDIT_AUTO_CLOSE_CHAR,
|
WRITE_CONFIG_EDITOR_SET(CODEEDIT_AUTO_CLOSE_CHAR,
|
||||||
SETTING_ITEM::AUTO_CLOSE_CHAR,
|
SETTING_ITEM::AUTO_CLOSE_CHAR,
|
||||||
m_editorAutoCloseChar);
|
m_editorAutoCloseChar);
|
||||||
|
WRITE_CONFIG_EDITOR_SET(CODEEDIT_AUTO_IDEN, SETTING_ITEM::AUTO_IDEN,
|
||||||
|
m_editorAutoIden);
|
||||||
emit editorSettingsUpdate();
|
emit editorSettingsUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,6 +227,8 @@ void ScriptSettings::reset(SETTINGS cat) {
|
||||||
SETTING_ITEM::SHOW_WHITESPACE, false);
|
SETTING_ITEM::SHOW_WHITESPACE, false);
|
||||||
WRITE_CONFIG_EDITOR_SET(CODEEDIT_AUTO_CLOSE_CHAR,
|
WRITE_CONFIG_EDITOR_SET(CODEEDIT_AUTO_CLOSE_CHAR,
|
||||||
SETTING_ITEM::AUTO_CLOSE_CHAR, true);
|
SETTING_ITEM::AUTO_CLOSE_CHAR, true);
|
||||||
|
WRITE_CONFIG_EDITOR_SET(CODEEDIT_AUTO_IDEN, SETTING_ITEM::AUTO_IDEN,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cat.testFlag(SETTING::CONSOLE)) {
|
if (cat.testFlag(SETTING::CONSOLE)) {
|
||||||
|
@ -251,6 +257,12 @@ ScriptSettings::ScriptSettings() : QObject() {
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScriptSettings::editorAutoIden() const { return m_editorAutoIden; }
|
||||||
|
|
||||||
|
void ScriptSettings::setEditorAutoIden(bool newEditorAutoIden) {
|
||||||
|
m_editorAutoIden = newEditorAutoIden;
|
||||||
|
}
|
||||||
|
|
||||||
bool ScriptSettings::consoleAutoCloseChar() const {
|
bool ScriptSettings::consoleAutoCloseChar() const {
|
||||||
return m_consoleAutoCloseChar;
|
return m_consoleAutoCloseChar;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,8 @@ private:
|
||||||
SHOW_INDENTGUIDES = 1u << 9,
|
SHOW_INDENTGUIDES = 1u << 9,
|
||||||
SHOW_LONGLINEEDGE = 1u << 10,
|
SHOW_LONGLINEEDGE = 1u << 10,
|
||||||
SHOW_WHITESPACE = 1u << 11,
|
SHOW_WHITESPACE = 1u << 11,
|
||||||
AUTO_CLOSE_CHAR = 1u << 12
|
AUTO_CLOSE_CHAR = 1u << 12,
|
||||||
|
AUTO_IDEN = 1u << 13
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(SETTING_ITEMS, SETTING_ITEM)
|
Q_DECLARE_FLAGS(SETTING_ITEMS, SETTING_ITEM)
|
||||||
|
|
||||||
|
@ -120,6 +121,9 @@ public:
|
||||||
bool consoleAutoCloseChar() const;
|
bool consoleAutoCloseChar() const;
|
||||||
void setConsoleAutoCloseChar(bool newConsoleAutoCloseChar);
|
void setConsoleAutoCloseChar(bool newConsoleAutoCloseChar);
|
||||||
|
|
||||||
|
bool editorAutoIden() const;
|
||||||
|
void setEditorAutoIden(bool newEditorAutoIden);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit ScriptSettings();
|
explicit ScriptSettings();
|
||||||
|
|
||||||
|
@ -153,6 +157,7 @@ private:
|
||||||
bool m_editorFolding = true;
|
bool m_editorFolding = true;
|
||||||
bool m_editorShowGuideLine = true;
|
bool m_editorShowGuideLine = true;
|
||||||
bool m_editorShowLineEdges = false;
|
bool m_editorShowLineEdges = false;
|
||||||
|
bool m_editorAutoIden = true;
|
||||||
|
|
||||||
bool m_editorShowWhiteSpace = false;
|
bool m_editorShowWhiteSpace = false;
|
||||||
bool m_consoleShowWhiteSpace = false;
|
bool m_consoleShowWhiteSpace = false;
|
||||||
|
|
|
@ -70,6 +70,7 @@ QIcon SkinManager::themeIcon(const QString &name) {
|
||||||
return QIcon(QStringLiteral("://light/") + name +
|
return QIcon(QStringLiteral("://light/") + name +
|
||||||
QStringLiteral(".svg"));
|
QStringLiteral(".svg"));
|
||||||
}
|
}
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
SkinManager::Theme SkinManager::currentTheme() const { return m_theme; }
|
SkinManager::Theme SkinManager::currentTheme() const { return m_theme; }
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include "model/codecompletionmodel.h"
|
#include "model/codecompletionmodel.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QIcon>
|
||||||
|
#include <QMenu>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
|
@ -40,6 +42,7 @@ CodeEdit::CodeEdit(QWidget *parent) : WingCodeEdit(parent) {
|
||||||
connect(&ScriptSettings::instance(), &ScriptSettings::editorSettingsUpdate,
|
connect(&ScriptSettings::instance(), &ScriptSettings::editorSettingsUpdate,
|
||||||
this, &CodeEdit::applyEditorSetStyle);
|
this, &CodeEdit::applyEditorSetStyle);
|
||||||
applyEditorSetStyle();
|
applyEditorSetStyle();
|
||||||
|
setShowSymbolMark(true);
|
||||||
|
|
||||||
m_searchWidget = new SearchReplaceWidget(this);
|
m_searchWidget = new SearchReplaceWidget(this);
|
||||||
connect(this, &CodeEdit::textChanged, this, [this] {
|
connect(this, &CodeEdit::textChanged, this, [this] {
|
||||||
|
@ -78,6 +81,7 @@ void CodeEdit::showSearchReplaceBar(bool show, bool replace) {
|
||||||
m_searchWidget->setSearchText(cursor.selectedText());
|
m_searchWidget->setSearchText(cursor.selectedText());
|
||||||
m_searchWidget->setReplaceMode(replace);
|
m_searchWidget->setReplaceMode(replace);
|
||||||
m_searchWidget->activate();
|
m_searchWidget->activate();
|
||||||
|
m_searchWidget->resize(m_searchWidget->sizeHint());
|
||||||
} else {
|
} else {
|
||||||
clearLiveSearch();
|
clearLiveSearch();
|
||||||
setFocus(Qt::OtherFocusReason);
|
setFocus(Qt::OtherFocusReason);
|
||||||
|
@ -91,6 +95,7 @@ void CodeEdit::showGotoBar(bool show) {
|
||||||
m_gotoWidget->setOriginLine(textCursor().blockNumber() + 1);
|
m_gotoWidget->setOriginLine(textCursor().blockNumber() + 1);
|
||||||
m_gotoWidget->setVisible(show);
|
m_gotoWidget->setVisible(show);
|
||||||
m_gotoWidget->setEnabled(show);
|
m_gotoWidget->setEnabled(show);
|
||||||
|
m_gotoWidget->resize(m_gotoWidget->sizeHint());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeEdit::onCompletion(const QModelIndex &index) {
|
void CodeEdit::onCompletion(const QModelIndex &index) {
|
||||||
|
@ -170,6 +175,7 @@ void CodeEdit::applyEditorSetStyle() {
|
||||||
this->setMatchBraces(set.editorMatchBraces());
|
this->setMatchBraces(set.editorMatchBraces());
|
||||||
this->setShowWhitespace(set.editorShowWhiteSpace());
|
this->setShowWhitespace(set.editorShowWhiteSpace());
|
||||||
this->setAutoCloseChar(set.editorAutoCloseChar());
|
this->setAutoCloseChar(set.editorAutoCloseChar());
|
||||||
|
this->setAutoIndent(set.editorAutoIden());
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchReplaceWidget *CodeEdit::searchWidget() const { return m_searchWidget; }
|
SearchReplaceWidget *CodeEdit::searchWidget() const { return m_searchWidget; }
|
||||||
|
@ -195,32 +201,128 @@ void CodeEdit::resizeEvent(QResizeEvent *event) {
|
||||||
|
|
||||||
void CodeEdit::keyPressEvent(QKeyEvent *event) {
|
void CodeEdit::keyPressEvent(QKeyEvent *event) {
|
||||||
bool unHandled = true;
|
bool unHandled = true;
|
||||||
switch (event->key()) {
|
if (event->matches(QKeySequence::Find)) {
|
||||||
case Qt::Key_Escape:
|
showSearchReplaceBar(true, false);
|
||||||
if (m_searchWidget->isVisible()) {
|
unHandled = false;
|
||||||
m_searchWidget->cancel();
|
} else if (event->matches(QKeySequence::Replace)) {
|
||||||
|
showSearchReplaceBar(true, true);
|
||||||
|
unHandled = false;
|
||||||
|
} else {
|
||||||
|
auto gotoSc =
|
||||||
|
QKeySequences::instance().keySequence(QKeySequences::Key::GOTO);
|
||||||
|
if (QKeySequence(event->keyCombination()).matches(gotoSc)) {
|
||||||
|
showGotoBar(true);
|
||||||
unHandled = false;
|
unHandled = false;
|
||||||
|
} else {
|
||||||
|
switch (event->key()) {
|
||||||
|
case Qt::Key_Escape:
|
||||||
|
if (m_searchWidget->isVisible()) {
|
||||||
|
m_searchWidget->cancel();
|
||||||
|
unHandled = false;
|
||||||
|
}
|
||||||
|
if (m_gotoWidget->isVisible()) {
|
||||||
|
m_gotoWidget->cancel();
|
||||||
|
unHandled = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Qt::Key_Return:
|
||||||
|
case Qt::Key_Enter:
|
||||||
|
if (m_searchWidget->isVisible()) {
|
||||||
|
m_searchWidget->accept();
|
||||||
|
unHandled = false;
|
||||||
|
}
|
||||||
|
if (m_gotoWidget->isVisible()) {
|
||||||
|
m_gotoWidget->accept();
|
||||||
|
unHandled = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (m_gotoWidget->isVisible()) {
|
|
||||||
m_gotoWidget->cancel();
|
|
||||||
unHandled = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Qt::Key_Return:
|
|
||||||
case Qt::Key_Enter:
|
|
||||||
if (m_searchWidget->isVisible()) {
|
|
||||||
m_searchWidget->accept();
|
|
||||||
unHandled = false;
|
|
||||||
}
|
|
||||||
if (m_gotoWidget->isVisible()) {
|
|
||||||
m_gotoWidget->accept();
|
|
||||||
unHandled = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unHandled) {
|
if (unHandled) {
|
||||||
WingCodeEdit::keyPressEvent(event);
|
WingCodeEdit::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeEdit::contextMenuEvent(QContextMenuEvent *event) {
|
||||||
|
QMenu menu(this);
|
||||||
|
|
||||||
|
menu.addAction(QIcon(QStringLiteral(":/qeditor/copy.png")), tr("Copy"),
|
||||||
|
QKeySequence(QKeySequence::Copy), this, &CodeEdit::copy);
|
||||||
|
menu.addAction(QIcon(QStringLiteral(":/qeditor/cut.png")), tr("Cut"),
|
||||||
|
QKeySequence(QKeySequence::Cut), this, &CodeEdit::cut);
|
||||||
|
menu.addAction(QIcon(QStringLiteral(":/qeditor/paste.png")), tr("Paste"),
|
||||||
|
QKeySequence(QKeySequence::Paste), this, &CodeEdit::paste);
|
||||||
|
menu.addSeparator();
|
||||||
|
|
||||||
|
menu.addAction(QIcon(QStringLiteral(":/qeditor/find.png")), tr("Find"),
|
||||||
|
QKeySequence(QKeySequence::Find), this,
|
||||||
|
[this]() { showSearchReplaceBar(true, false); });
|
||||||
|
menu.addAction(QIcon(QStringLiteral(":/qeditor/replace.png")),
|
||||||
|
tr("Replace"), QKeySequence(QKeySequence::Replace), this,
|
||||||
|
[this]() { showSearchReplaceBar(true, true); });
|
||||||
|
menu.addAction(
|
||||||
|
QIcon(QStringLiteral(":/qeditor/goto.png")), tr("Goto"),
|
||||||
|
QKeySequences::instance().keySequence(QKeySequences::Key::GOTO), this,
|
||||||
|
[this]() { showGotoBar(true); });
|
||||||
|
menu.addSeparator();
|
||||||
|
|
||||||
|
menu.addAction(tr("Comment/UnComment"),
|
||||||
|
QKeySequence(Qt::ControlModifier | Qt::Key_Backslash), this,
|
||||||
|
[this]() {
|
||||||
|
auto cursor = this->textCursor();
|
||||||
|
if (cursor.hasSelection()) {
|
||||||
|
auto start = cursor.selectionStart();
|
||||||
|
auto end = cursor.selectionEnd();
|
||||||
|
auto cmtbegin = QStringLiteral("/*");
|
||||||
|
auto cmtend = QStringLiteral("*/");
|
||||||
|
|
||||||
|
// only add comment
|
||||||
|
cursor.beginEditBlock();
|
||||||
|
cursor.setPosition(end);
|
||||||
|
cursor.insertText(cmtend);
|
||||||
|
cursor.setPosition(start);
|
||||||
|
cursor.insertText(cmtbegin);
|
||||||
|
cursor.endEditBlock();
|
||||||
|
} else {
|
||||||
|
auto blk = cursor.block();
|
||||||
|
auto txt = blk.text();
|
||||||
|
auto comment = QStringLiteral("//");
|
||||||
|
|
||||||
|
cursor.movePosition(QTextCursor::StartOfLine);
|
||||||
|
auto r = std::find_if_not(
|
||||||
|
txt.begin(), txt.end(),
|
||||||
|
[](const QChar &ch) { return ch.isSpace(); });
|
||||||
|
auto len = std::distance(txt.begin(), r);
|
||||||
|
cursor.movePosition(QTextCursor::NextCharacter,
|
||||||
|
QTextCursor::MoveAnchor, len);
|
||||||
|
auto oldcur = cursor;
|
||||||
|
if (r == txt.end() || len + 2 > txt.length()) {
|
||||||
|
cursor.insertText(comment);
|
||||||
|
} else {
|
||||||
|
cursor.movePosition(QTextCursor::NextCharacter,
|
||||||
|
QTextCursor::KeepAnchor, 2);
|
||||||
|
auto sel = cursor.selectedText();
|
||||||
|
if (sel == comment) {
|
||||||
|
cursor.removeSelectedText();
|
||||||
|
} else {
|
||||||
|
oldcur.insertText(comment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
menu.addAction(tr("Fold/UnFold"), this, [this]() {
|
||||||
|
if (isCurrentLineFolded()) {
|
||||||
|
unfoldCurrentLine();
|
||||||
|
} else {
|
||||||
|
foldCurrentLine();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menu.addAction(tr("FoldAll"), this, [this]() { foldAll(); });
|
||||||
|
|
||||||
|
menu.exec(event->globalPos());
|
||||||
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ private:
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent *event) override;
|
virtual void resizeEvent(QResizeEvent *event) override;
|
||||||
virtual void keyPressEvent(QKeyEvent *event) override;
|
virtual void keyPressEvent(QKeyEvent *event) override;
|
||||||
|
virtual void contextMenuEvent(QContextMenuEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void applyEditorSetStyle();
|
void applyEditorSetStyle();
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
/*==============================================================================
|
||||||
|
** 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 "codeeditcontrolwidget.h"
|
#include "codeeditcontrolwidget.h"
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
/*==============================================================================
|
||||||
|
** 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 CODEEDITCONTROLWIDGET_H
|
#ifndef CODEEDITCONTROLWIDGET_H
|
||||||
#define CODEEDITCONTROLWIDGET_H
|
#define CODEEDITCONTROLWIDGET_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
/*==============================================================================
|
||||||
|
** 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 "dockwidgettab.h"
|
#include "dockwidgettab.h"
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
/*==============================================================================
|
||||||
|
** 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 DOCKWIDGETTAB_H
|
#ifndef DOCKWIDGETTAB_H
|
||||||
#define DOCKWIDGETTAB_H
|
#define DOCKWIDGETTAB_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
/*==============================================================================
|
||||||
|
** 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 "popupactionwidget.h"
|
#include "popupactionwidget.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
/*==============================================================================
|
||||||
|
** 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 POPUPACTIONWIDGET_H
|
#ifndef POPUPACTIONWIDGET_H
|
||||||
#define POPUPACTIONWIDGET_H
|
#define POPUPACTIONWIDGET_H
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,9 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <QIcon>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QMenu>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
|
|
||||||
|
@ -43,27 +45,47 @@ ScriptingConsole::ScriptingConsole(QWidget *parent)
|
||||||
ScriptingConsole::~ScriptingConsole() {}
|
ScriptingConsole::~ScriptingConsole() {}
|
||||||
|
|
||||||
void ScriptingConsole::handleReturnKey() {
|
void ScriptingConsole::handleReturnKey() {
|
||||||
QString code = getCommandLine();
|
auto cursor = this->textCursor();
|
||||||
|
cursor.movePosition(QTextCursor::PreviousCharacter,
|
||||||
|
QTextCursor::KeepAnchor);
|
||||||
|
// TODO whether '\' is in a string ?
|
||||||
|
if (cursor.selectedText() == QStringLiteral("\\")) {
|
||||||
|
cursor = this->textCursor();
|
||||||
|
cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
|
||||||
|
auto restCode = cursor.selectedText();
|
||||||
|
cursor.removeSelectedText();
|
||||||
|
QString code = getCommandLine();
|
||||||
|
setMode(Output);
|
||||||
|
_codes += code.sliced(0, code.length() - 1);
|
||||||
|
appendCommandPrompt(true);
|
||||||
|
cursor = this->textCursor();
|
||||||
|
setMode(Input);
|
||||||
|
cursor.insertText(restCode);
|
||||||
|
cursor.movePosition(QTextCursor::PreviousCharacter);
|
||||||
|
setTextCursor(cursor);
|
||||||
|
} else {
|
||||||
|
QString code = getCommandLine();
|
||||||
|
|
||||||
// start new block
|
// start new block
|
||||||
appendPlainText(QString());
|
appendPlainText(QString());
|
||||||
dontHighlightLastLine();
|
dontHighlightLastLine();
|
||||||
setMode(Output);
|
setMode(Output);
|
||||||
|
|
||||||
QTextCursor textCursor = this->textCursor();
|
QTextCursor textCursor = this->textCursor();
|
||||||
textCursor.movePosition(QTextCursor::End);
|
textCursor.movePosition(QTextCursor::End);
|
||||||
setTextCursor(textCursor);
|
setTextCursor(textCursor);
|
||||||
|
|
||||||
// Update the history
|
// Update the history
|
||||||
if (!code.isEmpty())
|
if (!code.isEmpty())
|
||||||
history_.add(code);
|
history_.add(code);
|
||||||
|
|
||||||
// append the newline char and
|
// append the newline char and
|
||||||
// send signal / update iodevice
|
// send signal / update iodevice
|
||||||
if (iodevice_->isOpen())
|
if (iodevice_->isOpen())
|
||||||
iodevice_->consoleWidgetInput(code);
|
iodevice_->consoleWidgetInput(code);
|
||||||
|
|
||||||
emit consoleCommand(code);
|
emit consoleCommand(code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptingConsole::init() {
|
void ScriptingConsole::init() {
|
||||||
|
@ -75,49 +97,92 @@ void ScriptingConsole::init() {
|
||||||
connect(this, &ScriptingConsole::abortEvaluation, _sp,
|
connect(this, &ScriptingConsole::abortEvaluation, _sp,
|
||||||
&ScriptConsoleMachine::abortScript);
|
&ScriptConsoleMachine::abortScript);
|
||||||
|
|
||||||
connect(_sp, &ScriptConsoleMachine::onOutput, this,
|
connect(
|
||||||
[=](ScriptConsoleMachine::MessageType type,
|
_sp, &ScriptConsoleMachine::onOutput, this,
|
||||||
const ScriptConsoleMachine::MessageInfo &message) {
|
[=](ScriptConsoleMachine::MessageType type,
|
||||||
auto doc = this->document();
|
const ScriptConsoleMachine::MessageInfo &message) {
|
||||||
auto lastLine = doc->lastBlock();
|
// <type, <row, col>>
|
||||||
auto isNotBlockStart = !lastLine.text().isEmpty();
|
static QPair<ScriptConsoleMachine::MessageType, QPair<int, int>>
|
||||||
switch (type) {
|
lastInfo{ScriptConsoleMachine::MessageType::Print, {-1, -1}};
|
||||||
case ScriptMachine::MessageType::Info:
|
|
||||||
if (isNotBlockStart) {
|
auto doc = this->document();
|
||||||
newLine();
|
auto lastLine = doc->lastBlock();
|
||||||
}
|
auto isNotBlockStart = !lastLine.text().isEmpty();
|
||||||
stdOut(tr("[Info]") + message.message);
|
|
||||||
flush();
|
auto fmtMsg = [](const ScriptConsoleMachine::MessageInfo &message)
|
||||||
newLine();
|
-> QString {
|
||||||
break;
|
if (message.row <= 0 || message.col <= 0) {
|
||||||
case ScriptMachine::MessageType::Warn:
|
return message.message;
|
||||||
if (isNotBlockStart) {
|
} else {
|
||||||
newLine();
|
return QStringLiteral("(") + QString::number(message.row) +
|
||||||
}
|
QStringLiteral(", ") + QString::number(message.col) +
|
||||||
stdWarn(tr("[Warn]") + message.message);
|
QStringLiteral(") ") + message.message;
|
||||||
flush();
|
|
||||||
newLine();
|
|
||||||
break;
|
|
||||||
case ScriptMachine::MessageType::Error:
|
|
||||||
if (isNotBlockStart) {
|
|
||||||
newLine();
|
|
||||||
}
|
|
||||||
stdErr(tr("[Error]") + message.message);
|
|
||||||
flush();
|
|
||||||
newLine();
|
|
||||||
break;
|
|
||||||
case ScriptMachine::MessageType::Print:
|
|
||||||
// If running ouput in the console,
|
|
||||||
// otherwise logging.
|
|
||||||
if (_sp->isRunning()) {
|
|
||||||
stdOut(message.message);
|
|
||||||
} else {
|
|
||||||
Logger::logPrint(Logger::packDebugStr(
|
|
||||||
packUpLoggingStr(message.message)));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
auto isMatchLast =
|
||||||
|
[](ScriptConsoleMachine::MessageType type,
|
||||||
|
const ScriptConsoleMachine::MessageInfo &message) -> bool {
|
||||||
|
if (message.row < 0 || message.col < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return lastInfo.first == type &&
|
||||||
|
lastInfo.second.first == message.row &&
|
||||||
|
lastInfo.second.second == message.col;
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case ScriptMachine::MessageType::Info:
|
||||||
|
if (isMatchLast(type, message)) {
|
||||||
|
stdOut(message.message);
|
||||||
|
} else {
|
||||||
|
if (isNotBlockStart) {
|
||||||
|
newLine();
|
||||||
|
}
|
||||||
|
stdOut(tr("[Info]") + fmtMsg(message));
|
||||||
|
}
|
||||||
|
flush();
|
||||||
|
break;
|
||||||
|
case ScriptMachine::MessageType::Warn:
|
||||||
|
if (isMatchLast(type, message)) {
|
||||||
|
stdWarn(message.message);
|
||||||
|
} else {
|
||||||
|
if (isNotBlockStart) {
|
||||||
|
newLine();
|
||||||
|
}
|
||||||
|
stdWarn(tr("[Warn]") + fmtMsg(message));
|
||||||
|
}
|
||||||
|
flush();
|
||||||
|
break;
|
||||||
|
case ScriptMachine::MessageType::Error:
|
||||||
|
if (isMatchLast(type, message)) {
|
||||||
|
stdErr(message.message);
|
||||||
|
} else {
|
||||||
|
if (isNotBlockStart) {
|
||||||
|
newLine();
|
||||||
|
}
|
||||||
|
stdErr(tr("[Error]") + fmtMsg(message));
|
||||||
|
}
|
||||||
|
flush();
|
||||||
|
break;
|
||||||
|
case ScriptMachine::MessageType::Print:
|
||||||
|
if (lastInfo.first != type) {
|
||||||
|
newLine();
|
||||||
|
}
|
||||||
|
// If running ouput in the console,
|
||||||
|
// otherwise logging.
|
||||||
|
if (_sp->isRunning()) {
|
||||||
|
stdOut(message.message);
|
||||||
|
} else {
|
||||||
|
Logger::logPrint(Logger::packDebugStr(
|
||||||
|
packUpLoggingStr(message.message)));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastInfo.first = type;
|
||||||
|
lastInfo.second = qMakePair(message.row, message.col);
|
||||||
|
});
|
||||||
|
|
||||||
connect(this, &QConsoleWidget::consoleCommand, this,
|
connect(this, &QConsoleWidget::consoleCommand, this,
|
||||||
&ScriptingConsole::runConsoleCommand);
|
&ScriptingConsole::runConsoleCommand);
|
||||||
|
@ -228,3 +293,19 @@ QString ScriptingConsole::currentCodes() const {
|
||||||
ScriptMachine *ScriptingConsole::machine() const { return _sp; }
|
ScriptMachine *ScriptingConsole::machine() const { return _sp; }
|
||||||
|
|
||||||
ScriptConsoleMachine *ScriptingConsole::consoleMachine() const { return _sp; }
|
ScriptConsoleMachine *ScriptingConsole::consoleMachine() const { return _sp; }
|
||||||
|
|
||||||
|
void ScriptingConsole::contextMenuEvent(QContextMenuEvent *event) {
|
||||||
|
QMenu menu(this);
|
||||||
|
|
||||||
|
menu.addAction(QIcon(QStringLiteral(":/qeditor/copy.png")), tr("Copy"),
|
||||||
|
QKeySequence(QKeySequence::Copy), this,
|
||||||
|
&ScriptingConsole::copy);
|
||||||
|
menu.addAction(QIcon(QStringLiteral(":/qeditor/cut.png")), tr("Cut"),
|
||||||
|
QKeySequence(QKeySequence::Cut), this,
|
||||||
|
&ScriptingConsole::cut);
|
||||||
|
menu.addAction(QIcon(QStringLiteral(":/qeditor/paste.png")), tr("Paste"),
|
||||||
|
QKeySequence(QKeySequence::Paste), this,
|
||||||
|
&ScriptingConsole::paste);
|
||||||
|
|
||||||
|
menu.exec(event->globalPos());
|
||||||
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ private:
|
||||||
QString packUpLoggingStr(const QString &message);
|
QString packUpLoggingStr(const QString &message);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void contextMenuEvent(QContextMenuEvent *event) override;
|
||||||
void handleReturnKey() override;
|
void handleReturnKey() override;
|
||||||
void keyPressEvent(QKeyEvent *e) override;
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
|
||||||
|
|
|
@ -278,7 +278,9 @@ SearchReplaceWidget::SearchReplaceWidget(CodeEdit *editor)
|
||||||
connect(tbReplaceCur, &QToolButton::clicked, this,
|
connect(tbReplaceCur, &QToolButton::clicked, this,
|
||||||
&SearchReplaceWidget::replaceCurrent);
|
&SearchReplaceWidget::replaceCurrent);
|
||||||
connect(tbReplaceAll, &QToolButton::clicked, this, [this]() {
|
connect(tbReplaceAll, &QToolButton::clicked, this, [this]() {
|
||||||
|
performReplaceAll(m_replaceSel->isChecked()
|
||||||
|
? ReplaceAllMode::InSelection
|
||||||
|
: ReplaceAllMode::WholeDocument);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,8 +296,6 @@ void SearchReplaceWidget::setReplaceMode(bool b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchReplaceWidget::activate() {
|
void SearchReplaceWidget::activate() {
|
||||||
resize(sizeHint()); // readjust size (height)
|
|
||||||
|
|
||||||
m_searchParams.caseSensitive = m_caseSensitive->isChecked();
|
m_searchParams.caseSensitive = m_caseSensitive->isChecked();
|
||||||
m_searchParams.wholeWord = m_wholeWord->isChecked();
|
m_searchParams.wholeWord = m_wholeWord->isChecked();
|
||||||
m_searchParams.regex = m_regex->isChecked();
|
m_searchParams.regex = m_regex->isChecked();
|
||||||
|
|
|
@ -296,10 +296,11 @@ private:
|
||||||
auto a = new QToolButton(pannel);
|
auto a = new QToolButton(pannel);
|
||||||
#if QT_VERSION <= QT_VERSION_CHECK(6, 6, 0)
|
#if QT_VERSION <= QT_VERSION_CHECK(6, 6, 0)
|
||||||
if (menu) {
|
if (menu) {
|
||||||
a->setText(title + QStringLiteral(" 闁充紮鎷<E7B4AE>"));
|
a->setText(title + QChar(' ') + QChar(char16_t(0x25BC)));
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
a->setText(title);
|
a->setText(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,10 +596,10 @@ private:
|
||||||
// these variables will be invalid after restoring state
|
// these variables will be invalid after restoring state
|
||||||
ads::CDockAreaWidget *m_leftViewArea = nullptr;
|
ads::CDockAreaWidget *m_leftViewArea = nullptr;
|
||||||
ads::CDockAreaWidget *m_rightViewArea =
|
ads::CDockAreaWidget *m_rightViewArea =
|
||||||
nullptr; // 閻犲洢鍎遍埀顒勬?婵炲洭鎮介妸锔筋槯闊洤鎳嶇粭澶嬬▔閾忓厜鏁<EFBFBD>
|
nullptr; // 闂傚倷娴囧畷鍨叏閺夋嚚娲閵堝懐锛熼梻渚囧墮缁夋挳鎮為崹顐犱簻闁圭儤鍨甸顏堟煥濞戞艾鏋庨柍瑙勫灴閹瑩宕f径濠冪亷闂備浇顕栭崰鏇犲垝濞嗘劒绻嗛柟闂寸劍閺呮粎绱掑☉姗嗗剱鐞氀囨⒒閸屾凹鐓柛瀣鐓ら柕鍫濐槸缁犵姷鈧箍鍎卞ú銊х不閺傛鐔嗛悹杞拌閸庢垿鏌嶇紒妯活棃闁哄睙鍡欑杸闁规儳鍟挎潏鍛存⒑鏉炴壆绛忛柟鍑ゆ嫹
|
||||||
ads::CDockAreaWidget *m_topViewArea = nullptr;
|
ads::CDockAreaWidget *m_topViewArea = nullptr;
|
||||||
ads::CDockAreaWidget *m_bottomViewArea =
|
ads::CDockAreaWidget *m_bottomViewArea =
|
||||||
nullptr; // 閻犲洢鍎遍埀顒勬?婵炲洭鎮介妸锔筋槯闊洤鎳嶇粭澶嬬▔閾忓厜鏁<EFBFBD>
|
nullptr; // 闂傚倷娴囧畷鍨叏閺夋嚚娲閵堝懐锛熼梻渚囧墮缁夋挳鎮為崹顐犱簻闁圭儤鍨甸顏堟煥濞戞艾鏋庨柍瑙勫灴閹瑩宕f径濠冪亷闂備浇顕栭崰鏇犲垝濞嗘劒绻嗛柟闂寸劍閺呮粎绱掑☉姗嗗剱鐞氀囨⒒閸屾凹鐓柛瀣鐓ら柕鍫濐槸缁犵姷鈧箍鍎卞ú銊х不閺傛鐔嗛悹杞拌閸庢垿鏌嶇紒妯活棃闁哄睙鍡欑杸闁规儳鍟挎潏鍛存⒑鏉炴壆绛忛柟鍑ゆ嫹
|
||||||
|
|
||||||
//================================
|
//================================
|
||||||
|
|
||||||
|
|
|
@ -69,10 +69,10 @@ ScriptingDialog::ScriptingDialog(QWidget *parent)
|
||||||
_defaultLayout = m_dock->saveState();
|
_defaultLayout = m_dock->saveState();
|
||||||
layout->addWidget(m_dock, 1);
|
layout->addWidget(m_dock, 1);
|
||||||
|
|
||||||
auto status = new QStatusBar(this);
|
m_status = new QStatusBar(this);
|
||||||
m_status = new QLabel(this);
|
_status = new QLabel(this);
|
||||||
status->addWidget(m_status);
|
m_status->addPermanentWidget(_status);
|
||||||
layout->addWidget(status);
|
layout->addWidget(m_status);
|
||||||
buildUpContent(cw);
|
buildUpContent(cw);
|
||||||
|
|
||||||
buildUpSettingDialog();
|
buildUpSettingDialog();
|
||||||
|
@ -230,7 +230,7 @@ bool ScriptingDialog::about2Close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &view : need2CloseView) {
|
for (auto &view : need2CloseView) {
|
||||||
emit view->closeRequested();
|
view->requestCloseDockWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unSavedFiles.isEmpty()) {
|
if (unSavedFiles.isEmpty()) {
|
||||||
|
@ -248,7 +248,7 @@ bool ScriptingDialog::about2Close() {
|
||||||
QMessageBox::Cancel);
|
QMessageBox::Cancel);
|
||||||
if (ret == QMessageBox::Yes) {
|
if (ret == QMessageBox::Yes) {
|
||||||
for (auto &p : m_views) {
|
for (auto &p : m_views) {
|
||||||
emit p->closeRequested();
|
p->requestCloseDockWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_views.isEmpty();
|
return m_views.isEmpty();
|
||||||
|
@ -729,7 +729,7 @@ void ScriptingDialog::registerEditorView(ScriptEditor *editor) {
|
||||||
Q_ASSERT(m_views.contains(editor));
|
Q_ASSERT(m_views.contains(editor));
|
||||||
|
|
||||||
auto m = m_consoleout->machine();
|
auto m = m_consoleout->machine();
|
||||||
if (m->isDebugMode() && _DebugingEditor == editor) {
|
if (m->isRunning() && _DebugingEditor == editor) {
|
||||||
if (WingMessageBox::warning(
|
if (WingMessageBox::warning(
|
||||||
this, this->windowTitle(), tr("ScriptStillRunning"),
|
this, this->windowTitle(), tr("ScriptStillRunning"),
|
||||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
|
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
|
||||||
|
@ -783,8 +783,8 @@ void ScriptingDialog::registerEditorView(ScriptEditor *editor) {
|
||||||
});
|
});
|
||||||
connect(editor, &ScriptEditor::onFunctionTip, this,
|
connect(editor, &ScriptEditor::onFunctionTip, this,
|
||||||
[this](const QString &message) {
|
[this](const QString &message) {
|
||||||
m_status->setText(QStringLiteral("<b><font color=\"gold\">") +
|
_status->setText(QStringLiteral("<b><font color=\"gold\">") +
|
||||||
message + QStringLiteral("</font></b>"));
|
message + QStringLiteral("</font></b>"));
|
||||||
});
|
});
|
||||||
|
|
||||||
m_views.append(editor);
|
m_views.append(editor);
|
||||||
|
@ -825,6 +825,7 @@ void ScriptingDialog::swapEditor(ScriptEditor *old, ScriptEditor *cur) {
|
||||||
editor->disconnect(SIGNAL(contentModified(bool)));
|
editor->disconnect(SIGNAL(contentModified(bool)));
|
||||||
editor->disconnect(SIGNAL(undoAvailable(bool)));
|
editor->disconnect(SIGNAL(undoAvailable(bool)));
|
||||||
editor->disconnect(SIGNAL(redoAvailable(bool)));
|
editor->disconnect(SIGNAL(redoAvailable(bool)));
|
||||||
|
editor->disconnect(SIGNAL(cursorPositionChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto editor = cur->editor();
|
auto editor = cur->editor();
|
||||||
|
@ -853,7 +854,13 @@ void ScriptingDialog::swapEditor(ScriptEditor *old, ScriptEditor *cur) {
|
||||||
m_Tbtneditors.value(ToolButtonIndex::REDO_ACTION),
|
m_Tbtneditors.value(ToolButtonIndex::REDO_ACTION),
|
||||||
&QToolButton::setEnabled);
|
&QToolButton::setEnabled);
|
||||||
|
|
||||||
|
connect(editor, &CodeEdit::cursorPositionChanged, this,
|
||||||
|
&ScriptingDialog::updateCursorPosition);
|
||||||
|
connect(editor, &CodeEdit::selectionChanged, this,
|
||||||
|
&ScriptingDialog::updateCursorPosition);
|
||||||
|
|
||||||
m_curEditor = cur;
|
m_curEditor = cur;
|
||||||
|
updateCursorPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptingDialog::updateRunDebugMode(bool disable) {
|
void ScriptingDialog::updateRunDebugMode(bool disable) {
|
||||||
|
@ -888,14 +895,14 @@ void ScriptingDialog::updateRunDebugMode(bool disable) {
|
||||||
|
|
||||||
if (isRun) {
|
if (isRun) {
|
||||||
if (isDbg) {
|
if (isDbg) {
|
||||||
m_status->setText(QStringLiteral("<font color=\"gold\">") +
|
_status->setText(QStringLiteral("<font color=\"gold\">") +
|
||||||
tr("Debuging...") + QStringLiteral("</font>"));
|
tr("Debuging...") + QStringLiteral("</font>"));
|
||||||
} else {
|
} else {
|
||||||
m_status->setText(QStringLiteral("<font color=\"green\">") +
|
_status->setText(QStringLiteral("<font color=\"green\">") +
|
||||||
tr("Running...") + QStringLiteral("</font>"));
|
tr("Running...") + QStringLiteral("</font>"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_status->setText({});
|
_status->setText({});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1080,6 +1087,25 @@ void ScriptingDialog::toggleBreakPoint(ScriptEditor *editor, int line) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptingDialog::updateCursorPosition() {
|
||||||
|
auto editor = currentEditor();
|
||||||
|
if (editor) {
|
||||||
|
auto e = editor->editor();
|
||||||
|
const QTextCursor cursor = e->textCursor();
|
||||||
|
const int column =
|
||||||
|
e->textColumn(cursor.block().text(), cursor.positionInBlock());
|
||||||
|
const int selectedChars =
|
||||||
|
std::abs(cursor.selectionEnd() - cursor.selectionStart());
|
||||||
|
QString positionText =
|
||||||
|
tr("Line %1, Col %2").arg(cursor.blockNumber() + 1).arg(column + 1);
|
||||||
|
if (selectedChars)
|
||||||
|
positionText += tr(" (Selected: %1)").arg(selectedChars);
|
||||||
|
m_status->showMessage(positionText);
|
||||||
|
} else {
|
||||||
|
m_status->showMessage({});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptingDialog::on_newfile() {
|
void ScriptingDialog::on_newfile() {
|
||||||
if (!newOpenFileSafeCheck()) {
|
if (!newOpenFileSafeCheck()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -139,7 +139,7 @@ private:
|
||||||
auto a = new QToolButton(pannel);
|
auto a = new QToolButton(pannel);
|
||||||
#if QT_VERSION <= QT_VERSION_CHECK(6, 6, 0)
|
#if QT_VERSION <= QT_VERSION_CHECK(6, 6, 0)
|
||||||
if (menu) {
|
if (menu) {
|
||||||
a->setText(title + QStringLiteral(" 闂佸厖绱幏锟<E5B98F>"));
|
a->setText(title + QChar(' ') + QChar(char16_t(0x25BC)));
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
@ -220,6 +220,8 @@ private:
|
||||||
void removeBreakPoint(ScriptEditor *editor, int line);
|
void removeBreakPoint(ScriptEditor *editor, int line);
|
||||||
void toggleBreakPoint(ScriptEditor *editor, int line);
|
void toggleBreakPoint(ScriptEditor *editor, int line);
|
||||||
|
|
||||||
|
void updateCursorPosition();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_newfile();
|
void on_newfile();
|
||||||
void on_openfile();
|
void on_openfile();
|
||||||
|
@ -268,6 +270,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
ads::CDockManager *m_dock = nullptr;
|
ads::CDockManager *m_dock = nullptr;
|
||||||
ads::CDockAreaWidget *m_editorViewArea = nullptr;
|
ads::CDockAreaWidget *m_editorViewArea = nullptr;
|
||||||
|
QStatusBar *m_status = nullptr;
|
||||||
|
|
||||||
QByteArray _defaultLayout;
|
QByteArray _defaultLayout;
|
||||||
QByteArray _savedLayout;
|
QByteArray _savedLayout;
|
||||||
|
@ -298,7 +301,7 @@ private:
|
||||||
|
|
||||||
ScriptEditor *_DebugingEditor;
|
ScriptEditor *_DebugingEditor;
|
||||||
|
|
||||||
QLabel *m_status = nullptr;
|
QLabel *_status = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SCRIPTINGDIALOG_H
|
#endif // SCRIPTINGDIALOG_H
|
||||||
|
|
|
@ -70,11 +70,11 @@ ShowTextDialog::ShowTextDialog(QWidget *parent) : FramelessMainWindow(parent) {
|
||||||
layout->addWidget(q_check_ptr(m_ribbon));
|
layout->addWidget(q_check_ptr(m_ribbon));
|
||||||
|
|
||||||
m_edit = new CodeEdit(this);
|
m_edit = new CodeEdit(this);
|
||||||
|
m_edit->setShowSymbolMark(false);
|
||||||
|
|
||||||
m_edit->setReadOnly(true);
|
m_edit->setReadOnly(true);
|
||||||
m_edit->setAcceptDrops(false);
|
m_edit->setAcceptDrops(false);
|
||||||
m_edit->setUndoRedoEnabled(false);
|
m_edit->setUndoRedoEnabled(false);
|
||||||
// m_edit->createSimpleBasicContextMenu(true, true);
|
|
||||||
layout->addWidget(m_edit);
|
layout->addWidget(m_edit);
|
||||||
|
|
||||||
m_status = new QStatusBar(this);
|
m_status = new QStatusBar(this);
|
||||||
|
|
|
@ -152,6 +152,8 @@ QEditConfig::QEditConfig(bool isConsole, QWidget *w)
|
||||||
&CodeEdit::setMatchBraces);
|
&CodeEdit::setMatchBraces);
|
||||||
connect(ui->chkAutoCloseChar, &QCheckBox::toggled, _edit,
|
connect(ui->chkAutoCloseChar, &QCheckBox::toggled, _edit,
|
||||||
&CodeEdit::setAutoCloseChar);
|
&CodeEdit::setAutoCloseChar);
|
||||||
|
connect(ui->chkAutoIden, &QCheckBox::toggled, _edit,
|
||||||
|
&CodeEdit::setAutoIndent);
|
||||||
|
|
||||||
if (isConsole) {
|
if (isConsole) {
|
||||||
ui->chkShowLineNumber->setEnabled(false);
|
ui->chkShowLineNumber->setEnabled(false);
|
||||||
|
@ -159,6 +161,7 @@ QEditConfig::QEditConfig(bool isConsole, QWidget *w)
|
||||||
ui->chkShowIndentGuides->setEnabled(false);
|
ui->chkShowIndentGuides->setEnabled(false);
|
||||||
ui->chkWordWrap->setEnabled(false);
|
ui->chkWordWrap->setEnabled(false);
|
||||||
ui->chkLongLineEdge->setEnabled(false);
|
ui->chkLongLineEdge->setEnabled(false);
|
||||||
|
ui->chkAutoIden->setEnabled(false);
|
||||||
|
|
||||||
_name = tr("Console");
|
_name = tr("Console");
|
||||||
_id = QStringLiteral("Console");
|
_id = QStringLiteral("Console");
|
||||||
|
@ -214,6 +217,7 @@ void QEditConfig::apply() {
|
||||||
set.setEditorMatchBraces(ui->chkMatchBraces->isChecked());
|
set.setEditorMatchBraces(ui->chkMatchBraces->isChecked());
|
||||||
set.setEditorShowWhiteSpace(ui->chkShowWhitespace->isChecked());
|
set.setEditorShowWhiteSpace(ui->chkShowWhitespace->isChecked());
|
||||||
set.setEditorAutoCloseChar(ui->chkAutoCloseChar->isChecked());
|
set.setEditorAutoCloseChar(ui->chkAutoCloseChar->isChecked());
|
||||||
|
set.setEditorAutoIden(ui->chkAutoIden->isChecked());
|
||||||
}
|
}
|
||||||
set.save(m_isConsole ? ScriptSettings::CONSOLE : ScriptSettings::EDITOR);
|
set.save(m_isConsole ? ScriptSettings::CONSOLE : ScriptSettings::EDITOR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,46 @@
|
||||||
<string>Options</string>
|
<string>Options</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QCheckBox" name="chkMatchBraces">
|
||||||
|
<property name="text">
|
||||||
|
<string>MatchBraces</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QCheckBox" name="chkAutoCloseChar">
|
||||||
|
<property name="text">
|
||||||
|
<string>AutoCloseChar</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QCheckBox" name="chkShowFolding">
|
||||||
|
<property name="text">
|
||||||
|
<string>Folding</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QCheckBox" name="chkShowWhitespace">
|
||||||
|
<property name="text">
|
||||||
|
<string>Whitespace</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QCheckBox" name="chkShowLineNumber">
|
<widget class="QCheckBox" name="chkShowLineNumber">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -169,47 +209,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="0">
|
||||||
<widget class="QCheckBox" name="chkShowWhitespace">
|
|
||||||
<property name="text">
|
|
||||||
<string>Whitespace</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="3">
|
|
||||||
<widget class="QCheckBox" name="chkAutoCloseChar">
|
|
||||||
<property name="text">
|
|
||||||
<string>AutoCloseChar</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="2">
|
|
||||||
<widget class="QCheckBox" name="chkMatchBraces">
|
|
||||||
<property name="text">
|
|
||||||
<string>MatchBraces</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QCheckBox" name="chkShowFolding">
|
|
||||||
<property name="text">
|
|
||||||
<string>Folding</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
|
||||||
<widget class="QCheckBox" name="chkLongLineEdge">
|
<widget class="QCheckBox" name="chkLongLineEdge">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>LongLineEdge</string>
|
<string>LongLineEdge</string>
|
||||||
|
@ -219,7 +219,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="3">
|
||||||
<widget class="QCheckBox" name="chkShowIndentGuides">
|
<widget class="QCheckBox" name="chkShowIndentGuides">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>IndentGuides</string>
|
<string>IndentGuides</string>
|
||||||
|
@ -229,6 +229,16 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QCheckBox" name="chkAutoIden">
|
||||||
|
<property name="text">
|
||||||
|
<string>AutoIden</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in New Issue