This commit is contained in:
寂静的羽夏 2022-10-02 14:55:14 +08:00
parent 883250a38c
commit 0de27d7087
17 changed files with 951 additions and 78 deletions

View File

@ -18,22 +18,6 @@
  该软件如果没有任何插件,仅支持添加热键使用默认方式打开任何文件。插件的强大决定着该软件的上限,通过热键可以配置使用热键调用插件借口;默认通过鼠标中键配合`Ctrl`键可以调出工具窗口,选择合适的工具;也可以通过热键调出窗口工具,点击打开所需的文件或者软件,而不必从启动器翻找,避免任务栏图标过多以及桌面文件过多的情况。   该软件如果没有任何插件,仅支持添加热键使用默认方式打开任何文件。插件的强大决定着该软件的上限,通过热键可以配置使用热键调用插件借口;默认通过鼠标中键配合`Ctrl`键可以调出工具窗口,选择合适的工具;也可以通过热键调出窗口工具,点击打开所需的文件或者软件,而不必从启动器翻找,避免任务栏图标过多以及桌面文件过多的情况。
## TODO
  现在工具处于开发状态,很多功能并没有完成:
1. 配置相关(已完成 95%
2. 语言本地化(已完成 0%
  如下是已完成的功能:
1. 插件系统的设计
2. 热键调用功能
3. 工具窗口
4. 窗口工具
  待功能基本完成的时候,我会同步到我使用的所有代码托管平台。
### 协议 ### 协议
  本软件如果是开源版本将遵循`AGPL-3.0`协议,请勿用于该协议之外的用途。如果你想将本软件的代码用于闭源的商业代码,想要解除`GPL`系列的必须开源的限制,请必须亲自咨询我,商讨商业授权相关事宜。   本软件如果是开源版本将遵循`AGPL-3.0`协议,请勿用于该协议之外的用途。如果你想将本软件的代码用于闭源的商业代码,想要解除`GPL`系列的必须开源的限制,请必须亲自咨询我,商讨商业授权相关事宜。
@ -44,10 +28,6 @@
## 效果图 ## 效果图
  还没做完,就不放效果图了……
  还是放个草图吧,以免有人惦记:
<p align="center"> <p align="center">
<img src="screenshot.gif" > <img src="screenshot.gif" >
</p> </p>

View File

@ -33,4 +33,3 @@ DISTFILES += TestPlugin.json
RESOURCES += \ RESOURCES += \
resources.qrc resources.qrc

View File

@ -48,3 +48,7 @@ HEADERS += \
dialog/tooleditdialog.h \ dialog/tooleditdialog.h \
class/hotkey.h \ class/hotkey.h \
dialog/toolswapdialog.h dialog/toolswapdialog.h
TRANSLATIONS += \
$$PWD/lang/zh.ts

View File

@ -12,7 +12,17 @@ SettingManager::SettingManager(QObject *parent)
m_toolBox( m_toolBox(
QKeySequence(Qt::KeyboardModifier::ShiftModifier | Qt::Key_Space)), QKeySequence(Qt::KeyboardModifier::ShiftModifier | Qt::Key_Space)),
m_toolwinMod(Qt::KeyboardModifier::ControlModifier), m_toolwinMod(Qt::KeyboardModifier::ControlModifier),
m_toolMouse(Qt::MouseButton::MidButton) { m_toolMouse(Qt::MouseButton::MidButton), ismod(false), loaded(false) {
auto pathdir =
QString("%1/%2/%3")
.arg(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation))
.arg(qApp->organizationName())
.arg(qApp->applicationName());
QDir().mkpath(pathdir);
configfile = pathdir + "/config.conf";
m_instance = this; m_instance = this;
} }
@ -21,18 +31,12 @@ SettingManager *SettingManager::instance() { return m_instance; }
bool SettingManager::loadSettings(QString filename) { bool SettingManager::loadSettings(QString filename) {
#define CORRECTINFO(info) \ #define CORRECTINFO(info) \
info.pluginIndex = plgsys->pluginIndexByProvider(info.provider); \
if (info.isPlugin) { \ if (info.isPlugin) { \
info.pluginIndex = plgsys->pluginIndexByProvider(info.provider); \
info.process = plgsys->plugin(info.pluginIndex)->pluginName(); \ info.process = plgsys->plugin(info.pluginIndex)->pluginName(); \
} }
QString strConfigPath = filename.isEmpty() QString strConfigPath = filename.isEmpty() ? configfile : filename;
? QString("%1/%2/%3/config.conf")
.arg(QStandardPaths::writableLocation(
QStandardPaths::ConfigLocation))
.arg(qApp->organizationName())
.arg(qApp->applicationName())
: filename;
QFile f(strConfigPath); QFile f(strConfigPath);
QDataStream stream(&f); QDataStream stream(&f);
@ -46,6 +50,22 @@ bool SettingManager::loadSettings(QString filename) {
return false; return false;
} }
// 读取配置文件
char ver;
stream.readRawData(&ver, 1);
if (ver != CONFIGVER) {
f.close();
return false;
}
if (filename.length())
ismod = true;
// 如果已经加载了设置,重置重新加载
if (loaded)
resetSettings();
auto plgsys = PluginSystem::instance(); auto plgsys = PluginSystem::instance();
// General // General
@ -55,6 +75,8 @@ bool SettingManager::loadSettings(QString filename) {
// 读取结束,提示可以加载基础配置内容了 // 读取结束,提示可以加载基础配置内容了
emit loadedGeneral(); emit loadedGeneral();
QVector<QByteArray> hashes;
// 读取 Hotkey 的相关信息 // 读取 Hotkey 的相关信息
int len; int len;
stream >> len; // 先读取一下有几个 stream >> len; // 先读取一下有几个
@ -68,7 +90,17 @@ bool SettingManager::loadSettings(QString filename) {
buf.provider = QString::fromUtf8(arr); buf.provider = QString::fromUtf8(arr);
stream >> arr; stream >> arr;
buf.params = QString::fromUtf8(arr); buf.params = QString::fromUtf8(arr);
bool isStored;
stream >> isStored;
if (isStored) {
int index;
stream >> index;
arr = hashes[index];
} else {
stream >> arr; stream >> arr;
hashes.append(arr);
}
auto pi = plgsys->pluginIndexByProvider(buf.provider); auto pi = plgsys->pluginIndexByProvider(buf.provider);
// 找不到了,插件丢失或者不兼容 // 找不到了,插件丢失或者不兼容
@ -110,6 +142,18 @@ bool SettingManager::loadSettings(QString filename) {
buf.provider = QString::fromUtf8(arr); buf.provider = QString::fromUtf8(arr);
stream >> arr; stream >> arr;
buf.params = QString::fromUtf8(arr); buf.params = QString::fromUtf8(arr);
bool isStored;
stream >> isStored;
if (isStored) {
int index;
stream >> index;
arr = hashes[index];
} else {
stream >> arr;
hashes.append(arr);
}
auto pi = plgsys->pluginIndexByProvider(buf.provider); auto pi = plgsys->pluginIndexByProvider(buf.provider);
// 找不到了,插件丢失或者不兼容 // 找不到了,插件丢失或者不兼容
if (pi < 0) if (pi < 0)
@ -146,7 +190,18 @@ bool SettingManager::loadSettings(QString filename) {
buf.provider = QString::fromUtf8(arr); buf.provider = QString::fromUtf8(arr);
stream >> arr; stream >> arr;
buf.params = QString::fromUtf8(arr); buf.params = QString::fromUtf8(arr);
bool isStored;
stream >> isStored;
if (isStored) {
int index;
stream >> index;
arr = hashes[index];
} else {
stream >> arr; stream >> arr;
hashes.append(arr);
}
auto pi = plgsys->pluginIndexByProvider(buf.provider); auto pi = plgsys->pluginIndexByProvider(buf.provider);
// 找不到了,插件丢失或者不兼容 // 找不到了,插件丢失或者不兼容
if (pi < 0) if (pi < 0)
@ -173,16 +228,17 @@ bool SettingManager::loadSettings(QString filename) {
emit loadedGeneral(); emit loadedGeneral();
} }
f.close(); f.close();
loaded = true;
return true; return true;
} }
bool SettingManager::saveSettings() { bool SettingManager::saveSettings() {
QString strConfigPath = if (!ismod && QFile::exists(configfile))
QString("%1/%2/%3/config.conf") return true;
.arg(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)) auto res = exportSettings(configfile);
.arg(qApp->organizationName()) if (res)
.arg(qApp->applicationName()); ismod = false;
return exportSettings(strConfigPath); return res;
} }
bool SettingManager::exportSettings(QString filename) { bool SettingManager::exportSettings(QString filename) {
@ -190,8 +246,8 @@ bool SettingManager::exportSettings(QString filename) {
QDataStream stream(&f); QDataStream stream(&f);
if (f.open(QFile::WriteOnly)) { if (f.open(QFile::WriteOnly)) {
// 写文件头 // 写文件头
static char header[] = "WINGTOOL"; static char header[] = {'W', 'I', 'N', 'G', 'T', 'O', 'O', 'L', CONFIGVER};
stream.writeRawData(header, 8); stream.writeRawData(header, sizeof(header));
// General // General
stream << m_toolwin << m_wintool << m_toolGridSize << m_toolBox stream << m_toolwin << m_wintool << m_toolGridSize << m_toolBox
<< m_toolwinMod << m_toolMouse; << m_toolwinMod << m_toolMouse;
@ -204,13 +260,34 @@ bool SettingManager::exportSettings(QString filename) {
return false; return false;
} }
void SettingManager::resetSettings() {} void SettingManager::resetSettings() {
emit sigReset();
m_toolwin = true;
m_wintool = true;
m_toolGridSize = TOOLGRIDSIZE;
m_toolBox = QKeySequence(Qt::KeyboardModifier::ShiftModifier | Qt::Key_Space);
m_toolwinMod = Qt::KeyboardModifier::ControlModifier;
m_toolMouse = Qt::MouseButton::MidButton;
ismod = true;
// 更新 UI
emit sigToolwinEnabledChanged(m_toolwin);
emit sigWintoolEnabledChanged(m_wintool);
emit sigToolGridSizeChanged(m_toolGridSize);
emit sigToolBoxHotkeyChanged(m_toolBox);
emit sigToolwinModChanged(m_toolwinMod);
emit sigToolwinMouseBtnChanged(m_toolMouse);
}
void SettingManager::setModified() { ismod = true; }
int SettingManager::toolGridSize() const { return m_toolGridSize; } int SettingManager::toolGridSize() const { return m_toolGridSize; }
void SettingManager::setToolGridSize(const int v) { void SettingManager::setToolGridSize(const int v) {
if (v > 0) { if (v > 0) {
m_toolGridSize = v; m_toolGridSize = v;
ismod = true;
emit sigToolGridSizeChanged(v); emit sigToolGridSizeChanged(v);
} }
} }
@ -219,6 +296,7 @@ QKeySequence SettingManager::toolBoxHotkey() const { return m_toolBox; }
void SettingManager::setToolBoxHotkey(const QKeySequence seq) { void SettingManager::setToolBoxHotkey(const QKeySequence seq) {
m_toolBox = seq; m_toolBox = seq;
ismod = true;
emit sigToolBoxHotkeyChanged(seq); emit sigToolBoxHotkeyChanged(seq);
} }
@ -226,6 +304,7 @@ Qt::KeyboardModifier SettingManager::toolwinMod() const { return m_toolwinMod; }
void SettingManager::setToolwinMod(const Qt::KeyboardModifier &toolwinMod) { void SettingManager::setToolwinMod(const Qt::KeyboardModifier &toolwinMod) {
m_toolwinMod = toolwinMod; m_toolwinMod = toolwinMod;
ismod = true;
emit sigToolwinModChanged(toolwinMod); emit sigToolwinModChanged(toolwinMod);
} }
@ -233,6 +312,7 @@ Qt::MouseButton SettingManager::toolwinMouseBtn() const { return m_toolMouse; }
void SettingManager::setToolMouseBtn(const Qt::MouseButton &toolMouse) { void SettingManager::setToolMouseBtn(const Qt::MouseButton &toolMouse) {
m_toolMouse = toolMouse; m_toolMouse = toolMouse;
ismod = true;
emit sigToolwinMouseBtnChanged(toolMouse); emit sigToolwinMouseBtnChanged(toolMouse);
} }
@ -240,6 +320,7 @@ bool SettingManager::toolwinEnabled() const { return m_toolwin; }
void SettingManager::setToolwinEnabled(bool toolwin) { void SettingManager::setToolwinEnabled(bool toolwin) {
m_toolwin = toolwin; m_toolwin = toolwin;
ismod = true;
emit sigToolwinEnabledChanged(toolwin); emit sigToolwinEnabledChanged(toolwin);
} }
@ -247,5 +328,6 @@ bool SettingManager::wintoolEnabled() const { return m_wintool; }
void SettingManager::setWintoolEnabled(bool wintool) { void SettingManager::setWintoolEnabled(bool wintool) {
m_wintool = wintool; m_wintool = wintool;
ismod = true;
emit sigWintoolEnabledChanged(wintool); emit sigWintoolEnabledChanged(wintool);
} }

View File

@ -7,6 +7,7 @@
#include <QObject> #include <QObject>
#define TOOLGRIDSIZE 40 #define TOOLGRIDSIZE 40
#define CONFIGVER char(0)
class SettingManager : public QObject { class SettingManager : public QObject {
Q_OBJECT Q_OBJECT
@ -22,6 +23,8 @@ public:
void resetSettings(); void resetSettings();
public: public:
void setModified();
int toolGridSize() const; int toolGridSize() const;
void setToolGridSize(const int v); void setToolGridSize(const int v);
@ -55,6 +58,8 @@ signals:
void setToolWinInfo(int index, ToolStructInfo &info); void setToolWinInfo(int index, ToolStructInfo &info);
void addWinToolInfo(ToolStructInfo &info); void addWinToolInfo(ToolStructInfo &info);
void sigReset(); // 回归出厂配置信号
private: private:
static SettingManager *m_instance; static SettingManager *m_instance;
@ -65,6 +70,10 @@ private:
Qt::KeyboardModifier m_toolwinMod; Qt::KeyboardModifier m_toolwinMod;
Qt::MouseButton m_toolMouse; Qt::MouseButton m_toolMouse;
bool ismod, loaded;
QString configfile;
}; };
#endif // SETTINGMANAGER_H #endif // SETTINGMANAGER_H

View File

@ -6,6 +6,7 @@
DWIDGET_USE_NAMESPACE DWIDGET_USE_NAMESPACE
class WingApplication : public DApplication { class WingApplication : public DApplication {
Q_OBJECT
public: public:
WingApplication(int &argc, char **argv); WingApplication(int &argc, char **argv);

View File

@ -294,6 +294,7 @@ CenterWindow::CenterWindow(DMainWindow *parent) : DMainWindow(parent) {
if (d.exec()) { if (d.exec()) {
auto res = d.getResult(); auto res = d.getResult();
this->setoolWinInfo(sellbl, res); this->setoolWinInfo(sellbl, res);
sm->setModified();
emit lbls[sellbl]->toggled(true); emit lbls[sellbl]->toggled(true);
} }
}); });
@ -401,7 +402,12 @@ CenterWindow::CenterWindow(DMainWindow *parent) : DMainWindow(parent) {
AddMenuAction(tr("Down"), &CenterWindow::on_downWinTool); AddMenuAction(tr("Down"), &CenterWindow::on_downWinTool);
lscmenu.append(a); lscmenu.append(a);
AddMenuAction(tr("TopMost"), [=] { AddMenuAction(tr("TopMost"), [=] {
if (lstoolwin->count() == 1)
return;
auto sels = lstoolwin->selectionModel()->selectedRows(); auto sels = lstoolwin->selectionModel()->selectedRows();
if (sels.isEmpty())
return;
QVector<int> nums; QVector<int> nums;
for (auto &item : sels) { for (auto &item : sels) {
nums.append(item.row()); nums.append(item.row());
@ -425,10 +431,16 @@ CenterWindow::CenterWindow(DMainWindow *parent) : DMainWindow(parent) {
lstoolwin->insertItem(i, item); lstoolwin->insertItem(i, item);
wintool.mvItem(pi, i); wintool.mvItem(pi, i);
} }
sm->setModified();
}); });
lscmenu.append(a); lscmenu.append(a);
AddMenuAction(tr("DownMost"), [=] { AddMenuAction(tr("DownMost"), [=] {
if (lstoolwin->count() == 1)
return;
auto sels = lstoolwin->selectionModel()->selectedRows(); auto sels = lstoolwin->selectionModel()->selectedRows();
if (sels.isEmpty())
return;
QVector<int> nums; QVector<int> nums;
for (auto &item : sels) { for (auto &item : sels) {
nums.append(item.row()); nums.append(item.row());
@ -440,6 +452,7 @@ CenterWindow::CenterWindow(DMainWindow *parent) : DMainWindow(parent) {
int i = 0; int i = 0;
auto len = nums.count(); auto len = nums.count();
if (nums.first() == lstoolwin->count() - 1) { if (nums.first() == lstoolwin->count() - 1) {
i++;
int pi = nums.first(); int pi = nums.first();
for (; i < len; i++) { for (; i < len; i++) {
pi--; pi--;
@ -456,6 +469,7 @@ CenterWindow::CenterWindow(DMainWindow *parent) : DMainWindow(parent) {
lstoolwin->insertItem(i, item); lstoolwin->insertItem(i, item);
wintool.mvItem(pi, i); wintool.mvItem(pi, i);
} }
sm->setModified();
}); });
lscmenu.append(a); lscmenu.append(a);
lstoolwin->setContextMenuPolicy(Qt::CustomContextMenu); lstoolwin->setContextMenuPolicy(Qt::CustomContextMenu);
@ -642,6 +656,7 @@ void CenterWindow::editTask(int index) {
task = res; task = res;
manager->editHotkey(hk, res.seq); manager->editHotkey(hk, res.seq);
sm->setModified();
} }
} }
@ -669,6 +684,7 @@ void CenterWindow::on_removeHotkey() {
manager->unregisterHotkey(hk); manager->unregisterHotkey(hk);
tbhotkeys->removeRow(row); tbhotkeys->removeRow(row);
} }
sm->setModified();
} }
void CenterWindow::on_clearHotkey() { void CenterWindow::on_clearHotkey() {
@ -676,6 +692,7 @@ void CenterWindow::on_clearHotkey() {
hotkeys.clear(); hotkeys.clear();
manager->clearHotkey(); manager->clearHotkey();
tbhotkeys->setRowCount(0); tbhotkeys->setRowCount(0);
sm->setModified();
DMessageManager::instance()->sendMessage(this, ProgramIcon, DMessageManager::instance()->sendMessage(this, ProgramIcon,
tr("ClearSuccess")); tr("ClearSuccess"));
} }
@ -705,6 +722,7 @@ void CenterWindow::on_addHotkey() {
wt = new QTableWidgetItem(res.params); wt = new QTableWidgetItem(res.params);
wt->setToolTip(res.params); wt->setToolTip(res.params);
tbhotkeys->setItem(index, 3, wt); tbhotkeys->setItem(index, 3, wt);
sm->setModified();
} }
} }
@ -712,6 +730,7 @@ void CenterWindow::enableSelectedHotkeys(bool enable) {
auto selrows = tbhotkeys->selectionModel()->selectedRows(); auto selrows = tbhotkeys->selectionModel()->selectedRows();
for (auto &item : selrows) { for (auto &item : selrows) {
manager->enableHotKey(hotkeys[item.row()], enable); manager->enableHotKey(hotkeys[item.row()], enable);
sm->setModified();
} }
} }
@ -728,15 +747,20 @@ void CenterWindow::on_editWinTool() {
auto res = d.getResult(); auto res = d.getResult();
wintoolinfos[index] = res; wintoolinfos[index] = res;
auto item = lstoolwin->item(index); auto item = lstoolwin->item(index);
item->setIcon( auto plg = plgsys->plugin(res.pluginIndex);
Utilities::trimIconFromInfo(plgsys->plugin(res.pluginIndex), res)); item->setIcon(Utilities::trimIconFromInfo(plg, res));
item->setText(Utilities::getProgramName(res)); item->setText(Utilities::getProgramName(plg, res));
item->setToolTip(res.process); item->setToolTip(res.process);
sm->setModified();
} }
} }
void CenterWindow::on_removeWinTool() { void CenterWindow::on_removeWinTool() {
auto sels = lstoolwin->selectionModel()->selectedRows(); auto sels = lstoolwin->selectionModel()->selectedRows();
if (sels.isEmpty())
return;
QVector<int> nums; QVector<int> nums;
for (auto &item : sels) { for (auto &item : sels) {
nums.append(item.row()); nums.append(item.row());
@ -750,12 +774,14 @@ void CenterWindow::on_removeWinTool() {
delete item; delete item;
wintool.rmItem(index); wintool.rmItem(index);
} }
sm->setModified();
} }
void CenterWindow::on_clearWinTool() { void CenterWindow::on_clearWinTool() {
lstoolwin->clear(); lstoolwin->clear();
wintoolinfos.clear(); wintoolinfos.clear();
wintool.rmItem(-1); // 清空数据 wintool.rmItem(-1); // 清空数据
sm->setModified();
DMessageManager::instance()->sendMessage(this, ProgramIcon, DMessageManager::instance()->sendMessage(this, ProgramIcon,
tr("ClearSuccess")); tr("ClearSuccess"));
} }
@ -767,27 +793,32 @@ void CenterWindow::on_addWinTool() {
auto index = lstoolwin->currentRow(); auto index = lstoolwin->currentRow();
if (index < 0) { if (index < 0) {
wintoolinfos.append(res); wintoolinfos.append(res);
auto item = new QListWidgetItem( auto plg = plgsys->plugin(res.pluginIndex);
Utilities::trimIconFromInfo(plgsys->plugin(res.pluginIndex), res), auto item = new QListWidgetItem(Utilities::trimIconFromInfo(plg, res),
Utilities::getProgramName(res)); Utilities::getProgramName(plg, res));
item->setToolTip(res.process); item->setToolTip(Utilities::getToolTipContent(plg, res));
lstoolwin->addItem(item); lstoolwin->addItem(item);
wintool.addItem(res); wintool.addItem(res);
} else { } else {
wintoolinfos.insert(index + 1, res); wintoolinfos.insert(index + 1, res);
auto plg = plgsys->plugin(res.pluginIndex);
auto item = new QListWidgetItem( auto item = new QListWidgetItem(Utilities::trimIconFromInfo(plg, res),
Utilities::trimIconFromInfo(plgsys->plugin(res.pluginIndex), res), Utilities::getProgramName(plg, res));
Utilities::getProgramName(res)); item->setToolTip(Utilities::getToolTipContent(plg, res));
item->setToolTip(res.process);
lstoolwin->insertItem(index + 1, item); lstoolwin->insertItem(index + 1, item);
wintool.addItem(res, index + 1); wintool.addItem(res, index + 1);
} }
sm->setModified();
} }
} }
void CenterWindow::on_upWinTool() { void CenterWindow::on_upWinTool() {
if (lstoolwin->count() == 1)
return;
auto sels = lstoolwin->selectionModel()->selectedRows(); auto sels = lstoolwin->selectionModel()->selectedRows();
if (sels.isEmpty())
return;
QVector<int> nums; QVector<int> nums;
for (auto &item : sels) { for (auto &item : sels) {
nums.append(item.row()); nums.append(item.row());
@ -811,10 +842,17 @@ void CenterWindow::on_upWinTool() {
lstoolwin->insertItem(p - 1, item); lstoolwin->insertItem(p - 1, item);
wintool.mvItem(p, p - 1); wintool.mvItem(p, p - 1);
} }
sm->setModified();
} }
void CenterWindow::on_downWinTool() { void CenterWindow::on_downWinTool() {
if (lstoolwin->count() == 1)
return;
auto sels = lstoolwin->selectionModel()->selectedRows(); auto sels = lstoolwin->selectionModel()->selectedRows();
if (sels.isEmpty())
return;
QVector<int> nums; QVector<int> nums;
for (auto &item : sels) { for (auto &item : sels) {
nums.append(item.row()); nums.append(item.row());
@ -826,6 +864,7 @@ void CenterWindow::on_downWinTool() {
int i = 0; int i = 0;
auto len = nums.count(); auto len = nums.count();
if (nums.first() == lstoolwin->count() - 1) { if (nums.first() == lstoolwin->count() - 1) {
i++;
int pi = nums.first(); int pi = nums.first();
for (; i < len; i++) { for (; i < len; i++) {
pi--; pi--;
@ -842,6 +881,7 @@ void CenterWindow::on_downWinTool() {
lstoolwin->insertItem(p + 1, item); lstoolwin->insertItem(p + 1, item);
wintool.mvItem(p, p + 1); wintool.mvItem(p, p + 1);
} }
sm->setModified();
} }
void CenterWindow::on_exportSettings() { void CenterWindow::on_exportSettings() {
@ -905,10 +945,10 @@ void CenterWindow::setoolWinInfo(int index, ToolStructInfo &info) {
void CenterWindow::addWinToolInfo(ToolStructInfo &info) { void CenterWindow::addWinToolInfo(ToolStructInfo &info) {
wintoolinfos.append(info); wintoolinfos.append(info);
auto item = new QListWidgetItem( auto plg = plgsys->plugin(info.pluginIndex);
Utilities::trimIconFromInfo(plgsys->plugin(info.pluginIndex), info), auto item = new QListWidgetItem(Utilities::trimIconFromInfo(plg, info),
Utilities::getProgramName(info)); Utilities::getProgramName(plg, info));
item->setToolTip(info.process); item->setToolTip(Utilities::getToolTipContent(plg, info));
lstoolwin->addItem(item); lstoolwin->addItem(item);
wintool.addItem(info); wintool.addItem(info);
} }
@ -935,6 +975,7 @@ void CenterWindow::initGeneralSettings() {
sm->sigToolGridSizeChanged(sm->toolGridSize()); sm->sigToolGridSizeChanged(sm->toolGridSize());
connect(sbGridsize, QOverload<int>::of(&DSpinBox::valueChanged), sm, connect(sbGridsize, QOverload<int>::of(&DSpinBox::valueChanged), sm,
&SettingManager::setToolGridSize); &SettingManager::setToolGridSize);
connect(tabs, &DTabWidget::currentChanged, this, [=] { sm->saveSettings(); });
// WinTool 相关 // WinTool 相关
wintool.setModal(true); wintool.setModal(true);
@ -1077,13 +1118,20 @@ void CenterWindow::initAppManger() {
} }
void CenterWindow::getConfig(QDataStream &f) { void CenterWindow::getConfig(QDataStream &f) {
QVector<int> plgindices;
// 先保存 Hotkey 的相关信息 // 先保存 Hotkey 的相关信息
f << hotkeys.count(); // 先存一下有几个 f << hotkeys.count(); // 先存一下有几个
for (auto &p : scinfos) { for (auto &p : scinfos) {
f << p.enabled << p.isPlugin << p.seq; f << p.enabled << p.isPlugin << p.seq;
if (p.isPlugin) { if (p.isPlugin) {
f << p.serviceID << p.provider.toUtf8() << p.params.toUtf8() f << p.serviceID << p.provider.toUtf8() << p.params.toUtf8();
<< plgsys->pluginHash(p.pluginIndex); //最后存储 MD5 表示一条信息结束了 auto i = plgindices.indexOf(p.pluginIndex);
if (i >= 0) {
f << true << i;
} else {
f << false << plgsys->pluginHash(p.pluginIndex);
}
} else { } else {
f << p.process.toUtf8() f << p.process.toUtf8()
<< p.params.toUtf8(); // 如果是打开文件就没这么多事情了 << p.params.toUtf8(); // 如果是打开文件就没这么多事情了
@ -1100,9 +1148,13 @@ void CenterWindow::getConfig(QDataStream &f) {
if (p.enabled) { if (p.enabled) {
f << p.isPlugin; f << p.isPlugin;
if (p.isPlugin) { if (p.isPlugin) {
f << p.serviceID << p.provider.toUtf8() << p.params.toUtf8() f << p.serviceID << p.provider.toUtf8() << p.params.toUtf8();
<< plgsys->pluginHash( auto i = plgindices.indexOf(p.pluginIndex);
p.pluginIndex); //最后存储 MD5 表示一条信息结束了 if (i >= 0) {
f << true << i;
} else {
f << false << plgsys->pluginHash(p.pluginIndex);
}
} else { } else {
f << p.process.toUtf8() f << p.process.toUtf8()
<< p.params.toUtf8(); // 如果是打开文件就没这么多事情了 << p.params.toUtf8(); // 如果是打开文件就没这么多事情了
@ -1117,8 +1169,13 @@ void CenterWindow::getConfig(QDataStream &f) {
// 只存储相关基础信息就可以了 // 只存储相关基础信息就可以了
f << p.isPlugin; f << p.isPlugin;
if (p.isPlugin) { if (p.isPlugin) {
f << p.serviceID << p.provider.toUtf8() << p.params.toUtf8() f << p.serviceID << p.provider.toUtf8() << p.params.toUtf8();
<< plgsys->pluginHash(p.pluginIndex); //最后存储 MD5 表示一条信息结束了 auto i = plgindices.indexOf(p.pluginIndex);
if (i >= 0) {
f << true << i;
} else {
f << false << plgsys->pluginHash(p.pluginIndex);
}
} else { } else {
f << p.process.toUtf8() f << p.process.toUtf8()
<< p.params.toUtf8(); // 如果是打开文件就没这么多事情了 << p.params.toUtf8(); // 如果是打开文件就没这么多事情了
@ -1128,7 +1185,26 @@ void CenterWindow::getConfig(QDataStream &f) {
// 保存完毕,可以返回了 // 保存完毕,可以返回了
} }
void CenterWindow::resetConfig() {
ToolStructInfo toolinfo;
for (auto i = 0; i < 9; i++) {
toolinfos[i] = toolinfo;
QIcon icon;
auto ilbl = lbls[i];
ilbl->setIcon(icon);
manager->setToolIcon(i, icon);
}
lstoolwin->clear();
wintoolinfos.clear();
wintool.rmItem(-1);
}
void CenterWindow::closeEvent(QCloseEvent *event) { void CenterWindow::closeEvent(QCloseEvent *event) {
event->ignore(); event->ignore();
hide(); hide();
} }
void CenterWindow::showEvent(QShowEvent *event) {
Q_UNUSED(event);
sm->saveSettings();
}

View File

@ -72,9 +72,11 @@ public slots:
void initPluginSys(); void initPluginSys();
void initAppManger(); void initAppManger();
void getConfig(QDataStream &f); void getConfig(QDataStream &f);
void resetConfig();
protected: protected:
void closeEvent(QCloseEvent *event) override; void closeEvent(QCloseEvent *event) override;
void showEvent(QShowEvent *event) override;
private: private:
QList<QAction *> hkcmenu, lscmenu; QList<QAction *> hkcmenu, lscmenu;

View File

@ -44,7 +44,10 @@ void ToolBoxWindow::addItem(ToolStructInfo &info, int index) {
auto plgsys = PluginSystem::instance(); auto plgsys = PluginSystem::instance();
auto plg = plgsys->plugin(info.pluginIndex); auto plg = plgsys->plugin(info.pluginIndex);
auto icon = Utilities::trimIconFromInfo(plg, info); auto icon = Utilities::trimIconFromInfo(plg, info);
QString content = tr("Process:") + Utilities::getProgramName(info) + '\n'; QString content =
tr("Process:") +
(info.isPlugin ? info.process : QFileInfo(info.process).fileName()) +
'\n';
if (info.isPlugin) if (info.isPlugin)
content += (tr("Service:") + plg->pluginServices()[info.serviceID]); content += (tr("Service:") + plg->pluginServices()[info.serviceID]);

View File

@ -17,6 +17,7 @@
DWIDGET_USE_NAMESPACE DWIDGET_USE_NAMESPACE
class ToolEditDialog : public DDialog { class ToolEditDialog : public DDialog {
Q_OBJECT
public: public:
ToolEditDialog(ToolStructInfo res = ToolStructInfo(), ToolEditDialog(ToolStructInfo res = ToolStructInfo(),
DMainWindow *parent = nullptr); DMainWindow *parent = nullptr);

View File

@ -9,6 +9,7 @@
DWIDGET_USE_NAMESPACE DWIDGET_USE_NAMESPACE
class ToolSwapDialog : public DDialog { class ToolSwapDialog : public DDialog {
Q_OBJECT
public: public:
ToolSwapDialog(const QVector<QIcon> &icons, int selindex, ToolSwapDialog(const QVector<QIcon> &icons, int selindex,
DDialog *parent = nullptr); DDialog *parent = nullptr);

13
images/README.md Normal file
View File

@ -0,0 +1,13 @@
## WingTool
&emsp;&emsp;`WingTool`是一个强大的插件工具箱,中文名`羽云工具箱`,支持热键响应、鼠标跟踪、选词等相关借口。通过开发强大的对应的插件,就可以大大提高生产力。
&emsp;&emsp;该软件如果没有任何插件,仅支持添加热键使用默认方式打开任何文件。插件的强大决定着该软件的上限,通过热键可以配置使用热键调用插件借口;默认通过鼠标中键配合`Ctrl`键可以调出工具窗口,选择合适的工具;也可以通过热键调出窗口工具,点击打开所需的文件或者软件,而不必从启动器翻找,避免任务栏图标过多以及桌面文件过多的情况。
### 协议
&emsp;&emsp;本软件如果是开源版本将遵循`AGPL-3.0`协议,请勿用于该协议之外的用途。如果你想将本软件的代码用于闭源的商业代码,想要解除`GPL`系列的必须开源的限制,请必须亲自咨询我,商讨商业授权相关事宜。
## 有关 issue
&emsp;&emsp;本软件定位是本地生产力基础工具,旨在快速启动和使用高效工具。本人不考虑像 utool 和 quicker 之类提供插件商店。该程序不会进行与网络相关的任何操作,所有的插件安装都是本地的。如果有仅本地的需要,待该软件出 beta 之后,可以尝试该软件,发现 Bug 并递交修复。

BIN
lang/zh.qm Normal file

Binary file not shown.

677
lang/zh.ts Normal file
View File

@ -0,0 +1,677 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN">
<context>
<name>CenterWindow</name>
<message>
<location filename="../dialog/centerwindow.cpp" line="28"/>
<location filename="../dialog/centerwindow.cpp" line="33"/>
<source>CenterWindow</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="45"/>
<source>Common</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="58"/>
<source>EnabledToolWin</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="60"/>
<source>EnabledWinTool</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="65"/>
<source>ToolWinGridSize</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="73"/>
<source>Shortcut</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="81"/>
<source>ToolBox:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="89"/>
<source>Left</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="89"/>
<source>Right</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="89"/>
<source>Middle</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="89"/>
<source>XButton1</source>
<translation>XButton1</translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="89"/>
<source>XButton2</source>
<translation>XButton2</translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="92"/>
<source>ToolWin:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="95"/>
<source>Config</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="101"/>
<source>Export</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="105"/>
<source>Import</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="109"/>
<source>Save</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="112"/>
<source>Reset</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="120"/>
<source>Software</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="125"/>
<source>%1 , Ver %2 , by WingSummer.</source>
<translation>%1%2</translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="131"/>
<source>General</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="139"/>
<location filename="../dialog/centerwindow.cpp" line="178"/>
<location filename="../dialog/centerwindow.cpp" line="355"/>
<location filename="../dialog/centerwindow.cpp" line="393"/>
<source>Add</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="142"/>
<location filename="../dialog/centerwindow.cpp" line="181"/>
<location filename="../dialog/centerwindow.cpp" line="361"/>
<location filename="../dialog/centerwindow.cpp" line="396"/>
<source>Remove</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="145"/>
<location filename="../dialog/centerwindow.cpp" line="179"/>
<location filename="../dialog/centerwindow.cpp" line="291"/>
<location filename="../dialog/centerwindow.cpp" line="367"/>
<location filename="../dialog/centerwindow.cpp" line="394"/>
<source>Edit</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="148"/>
<location filename="../dialog/centerwindow.cpp" line="183"/>
<location filename="../dialog/centerwindow.cpp" line="385"/>
<location filename="../dialog/centerwindow.cpp" line="398"/>
<source>Clear</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="161"/>
<location filename="../dialog/centerwindow.cpp" line="173"/>
<source>Enable</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="161"/>
<source>HotKey</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="161"/>
<source>Exec</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="161"/>
<source>Params</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="175"/>
<source>Disable</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="207"/>
<source>Hotkeys</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="244"/>
<source>[Plugin]</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="246"/>
<source>Service:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="248"/>
<location filename="../dialog/centerwindow.cpp" line="267"/>
<source>Params:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="261"/>
<location filename="../dialog/centerwindow.cpp" line="269"/>
<source>NoTool</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="265"/>
<source>[File]</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="266"/>
<source>FileName:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="305"/>
<source>Swap</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="333"/>
<source>Delete</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="373"/>
<location filename="../dialog/centerwindow.cpp" line="400"/>
<source>Up</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="379"/>
<location filename="../dialog/centerwindow.cpp" line="402"/>
<source>Down</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="404"/>
<source>TopMost</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="437"/>
<source>DownMost</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="488"/>
<source>ToolBox</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="500"/>
<location filename="../dialog/centerwindow.cpp" line="513"/>
<source>No selected plugin.</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="503"/>
<source>Setting</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="520"/>
<source>Name:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="538"/>
<source>RegisteredHotkey:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="544"/>
<source>Plugins</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="563"/>
<source>About</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="568"/>
<source>ThanksForSponsor</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="576"/>
<source>Sponsor</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="626"/>
<source>runErr</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="631"/>
<source>err</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="631"/>
<source>openErr</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="697"/>
<location filename="../dialog/centerwindow.cpp" line="786"/>
<source>ClearSuccess</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="707"/>
<source>HotkeyRegisterFail</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="741"/>
<source>PleaseSelectOne</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="889"/>
<location filename="../dialog/centerwindow.cpp" line="901"/>
<source>Config (*.wtcfg)</source>
<translation> (*.wtcfg)</translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="895"/>
<source>ExportSuccess</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="907"/>
<source>ImportSuccess</source>
<translation></translation>
</message>
</context>
<context>
<name>PluginSelDialog</name>
<message>
<location filename="../dialog/pluginseldialog.cpp" line="10"/>
<source>PluginSelectingDialog</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/pluginseldialog.cpp" line="31"/>
<source>No selected plugin.</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/pluginseldialog.cpp" line="36"/>
<source>Name:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/pluginseldialog.cpp" line="61"/>
<source>Select</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/pluginseldialog.cpp" line="66"/>
<source>NoSelection</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/pluginseldialog.cpp" line="73"/>
<source>NoPlugin</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/pluginseldialog.cpp" line="76"/>
<source>Cancel</source>
<translation></translation>
</message>
</context>
<context>
<name>PluginSystem</name>
<message>
<location filename="../plugin/pluginsystem.cpp" line="160"/>
<source>ErrLoadPluginSign</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/pluginsystem.cpp" line="166"/>
<source>ErrLoadPluginSDKVersion</source>
<translation> SDK </translation>
</message>
<message>
<location filename="../plugin/pluginsystem.cpp" line="172"/>
<source>ErrLoadPluginNoName</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/pluginsystem.cpp" line="179"/>
<source>ErLoadPluginProvider</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/pluginsystem.cpp" line="188"/>
<location filename="../plugin/pluginsystem.cpp" line="196"/>
<source>ErLoadPluginService</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/pluginsystem.cpp" line="208"/>
<source>ErrLoadInitPlugin</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/pluginsystem.cpp" line="225"/>
<source>PluginInitRegister</source>
<translation></translation>
</message>
<message>
<location filename="../plugin/pluginsystem.cpp" line="331"/>
<source>ErrLoadPluginLoc</source>
<translation></translation>
</message>
</context>
<context>
<name>QHotkey</name>
<message>
<location filename="../QHotkey/qhotkey.cpp" line="259"/>
<source>Failed to register %1. Error: %2</source>
<translation> %1. %2</translation>
</message>
<message>
<location filename="../QHotkey/qhotkey.cpp" line="279"/>
<source>Failed to unregister %1. Error: %2</source>
<translation> %1. %2</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../dialog/centerwindow.cpp" line="245"/>
<source>PluginName:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="253"/>
<location filename="../dialog/centerwindow.cpp" line="524"/>
<location filename="../dialog/pluginseldialog.cpp" line="40"/>
<source>Catagory:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="255"/>
<location filename="../dialog/centerwindow.cpp" line="526"/>
<source>Version:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="257"/>
<location filename="../dialog/centerwindow.cpp" line="528"/>
<location filename="../dialog/pluginseldialog.cpp" line="44"/>
<source>Author:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="258"/>
<location filename="../dialog/centerwindow.cpp" line="529"/>
<location filename="../dialog/pluginseldialog.cpp" line="45"/>
<source>Comment:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="259"/>
<location filename="../dialog/centerwindow.cpp" line="530"/>
<location filename="../dialog/pluginseldialog.cpp" line="46"/>
<source>Provider:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/centerwindow.cpp" line="532"/>
<location filename="../dialog/pluginseldialog.cpp" line="47"/>
<source>Services:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/pluginseldialog.cpp" line="42"/>
<source>Version</source>
<translation></translation>
</message>
<message>
<location filename="../main.cpp" line="52"/>
<location filename="../main.cpp" line="58"/>
<source>WingTool</source>
<translation></translation>
</message>
<message>
<location filename="../main.cpp" line="124"/>
<source>ShowMain</source>
<translation></translation>
</message>
<message>
<location filename="../main.cpp" line="129"/>
<source>About</source>
<translation></translation>
</message>
<message>
<location filename="../main.cpp" line="133"/>
<source>Sponsor</source>
<translation></translation>
</message>
<message>
<location filename="../main.cpp" line="137"/>
<location filename="../main.cpp" line="139"/>
<source>Exit</source>
<translation>退</translation>
</message>
<message>
<location filename="../main.cpp" line="140"/>
<source>ConfirmExit</source>
<translation></translation>
</message>
<message>
<location filename="../utilities.h" line="134"/>
<source>Process:%1
Service:%2
Params:%3</source>
<translation>%1
%2
%3</translation>
</message>
<message>
<location filename="../utilities.h" line="139"/>
<source>Process:%1
Params:%2</source>
<translation>%1
%2</translation>
</message>
</context>
<context>
<name>ShortCutEditDialog</name>
<message>
<location filename="../dialog/shortcuteditdialog.cpp" line="13"/>
<source>HotkeyEdit</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/shortcuteditdialog.cpp" line="15"/>
<source>Enabled</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/shortcuteditdialog.cpp" line="25"/>
<source>ShortCut</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/shortcuteditdialog.cpp" line="32"/>
<source>Plugin</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/shortcuteditdialog.cpp" line="38"/>
<location filename="../dialog/shortcuteditdialog.cpp" line="53"/>
<source>Service</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/shortcuteditdialog.cpp" line="44"/>
<location filename="../dialog/shortcuteditdialog.cpp" line="53"/>
<source>FilePath</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/shortcuteditdialog.cpp" line="72"/>
<source>Param</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/shortcuteditdialog.cpp" line="99"/>
<source>NoHotkeySet</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/shortcuteditdialog.cpp" line="115"/>
<source>NoProcessSet</source>
<translation></translation>
</message>
</context>
<context>
<name>ToolBoxWindow</name>
<message>
<location filename="../dialog/toolboxwindow.cpp" line="11"/>
<source>PleaseChoose</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/toolboxwindow.cpp" line="48"/>
<source>Process:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/toolboxwindow.cpp" line="53"/>
<source>Service:</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/toolboxwindow.cpp" line="55"/>
<source>Params:</source>
<translation></translation>
</message>
</context>
<context>
<name>ToolEditDialog</name>
<message>
<location filename="../dialog/tooleditdialog.cpp" line="12"/>
<source>ToolWinEdit</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/tooleditdialog.cpp" line="15"/>
<source>Plugin</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/tooleditdialog.cpp" line="21"/>
<location filename="../dialog/tooleditdialog.cpp" line="36"/>
<source>Service</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/tooleditdialog.cpp" line="27"/>
<location filename="../dialog/tooleditdialog.cpp" line="36"/>
<source>FilePath</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/tooleditdialog.cpp" line="55"/>
<source>Param</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/tooleditdialog.cpp" line="88"/>
<source>NoProcessSet</source>
<translation></translation>
</message>
</context>
<context>
<name>ToolSwapDialog</name>
<message>
<location filename="../dialog/toolswapdialog.cpp" line="12"/>
<source>ToolSwapDialog</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/toolswapdialog.cpp" line="14"/>
<source>PleaseSelect</source>
<translation></translation>
</message>
<message>
<location filename="../dialog/toolswapdialog.cpp" line="58"/>
<source>NoSelect</source>
<translation></translation>
</message>
</context>
<context>
<name>WingApplication</name>
<message>
<location filename="../class/wingapplication.cpp" line="36"/>
<location filename="../class/wingapplication.cpp" line="61"/>
<source>Error</source>
<translation></translation>
</message>
<message>
<location filename="../class/wingapplication.cpp" line="37"/>
<location filename="../class/wingapplication.cpp" line="62"/>
<source>WriteErrorLogError</source>
<translation></translation>
</message>
<message>
<location filename="../class/wingapplication.cpp" line="38"/>
<location filename="../class/wingapplication.cpp" line="63"/>
<source>Crash</source>
<translation></translation>
</message>
</context>
</TS>

View File

@ -38,15 +38,14 @@ int main(int argc, char *argv[]) {
WingApplication a(fakeArgc, fakeArgs.data()); WingApplication a(fakeArgc, fakeArgs.data());
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
// auto s = a.applicationDirPath() + "/lang/default.qm"; auto s = a.applicationDirPath() + "/lang/default.qm";
// QTranslator translator; QTranslator translator;
// if (!translator.load(s)) { if (!translator.load(s)) {
// DMessageBox::critical(nullptr, "Error", "Error Loading Translation DMessageBox::critical(nullptr, "Error", "Error Loading Translation File !",
// File!", DMessageBox::Ok);
// DMessageBox::Ok); return -1;
// return -1; }
// } a.installTranslator(&translator);
// a.installTranslator(&translator);
a.setOrganizationName("WingCloud"); a.setOrganizationName("WingCloud");
a.setApplicationName(QObject::tr("WingTool")); a.setApplicationName(QObject::tr("WingTool"));
@ -103,6 +102,9 @@ int main(int argc, char *argv[]) {
&CenterWindow::addWinToolInfo); &CenterWindow::addWinToolInfo);
QObject::connect(&sm, &SettingManager::sigSaveConfig, &w, QObject::connect(&sm, &SettingManager::sigSaveConfig, &w,
&CenterWindow::getConfig); &CenterWindow::getConfig);
QObject::connect(&sm, &SettingManager::sigReset, &w,
&CenterWindow::resetConfig);
sm.loadSettings(); sm.loadSettings();
QObject::connect(&manager, &AppManager::checkToolShow, QObject::connect(&manager, &AppManager::checkToolShow,
@ -132,9 +134,16 @@ int main(int argc, char *argv[]) {
[&w] { w.show(CenterWindow::TabPage::Sponsor); }); [&w] { w.show(CenterWindow::TabPage::Sponsor); });
sysmenu.addAction(ac); sysmenu.addAction(ac);
ac = new QAction(QObject::tr("Exit"), menu); ac = new QAction(QObject::tr("Exit"), menu);
QObject::connect(ac, &QAction::triggered, [] { QApplication::exit(0); }); QObject::connect(ac, &QAction::triggered, [&w, &sm] {
if (DMessageBox::question(&w, QObject::tr("Exit"),
QObject::tr("ConfirmExit")) == DMessageBox::Yes) {
sm.saveSettings();
QApplication::exit(0);
}
});
sysmenu.addAction(ac); sysmenu.addAction(ac);
systray.setContextMenu(menu); systray.setContextMenu(menu);
systray.setToolTip(QObject::tr("WingTool"));
systray.setIcon(picon); systray.setIcon(picon);
systray.show(); systray.show();

View File

@ -12,5 +12,6 @@
<file>images/edit.svg</file> <file>images/edit.svg</file>
<file>images/up.svg</file> <file>images/up.svg</file>
<file>images/swap.svg</file> <file>images/swap.svg</file>
<file>images/README.md</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -123,8 +123,23 @@ public:
} }
} }
static QString getProgramName(ToolStructInfo &info) { static QString getProgramName(IWingToolPlg *plg, ToolStructInfo &info) {
return info.isPlugin ? info.process : QFileInfo(info.process).fileName(); return info.isPlugin
? info.process + " | " + plg->pluginServices()[info.serviceID]
: QFileInfo(info.process).fileName();
}
static QString getToolTipContent(IWingToolPlg *plg, ToolStructInfo &info) {
if (info.isPlugin) {
return QObject::tr("Process:%1\nService:%2\nParams:%3")
.arg(info.process)
.arg(plg->pluginServices()[info.serviceID])
.arg(info.params);
} else {
return QObject::tr("Process:%1\nParams:%2")
.arg(info.process)
.arg(info.params);
}
} }
}; };