Commit 7e12663a authored by Qiu Chuntao's avatar Qiu Chuntao

Optimize the code

parent f7015004
Pipeline #11766 failed with stage
in 1 minute and 5 seconds
[ [
{ {
"name": "topikm6-topsys", "name": "usermgt",
"version": "6.1.63", "version": "6.1.63",
"os": "windows", "os": "windows",
"arch": "x86", "arch": "x86",
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
"noqt": false, "noqt": false,
"devDependencies": { "devDependencies": {
"topikm6-frame": "^6.0.0", "topikm6-frame": "^6.0.0",
"topikm6-topsys": "^6.1.0",
"topikm6-templateclass": "^1.0.0" "topikm6-templateclass": "^1.0.0"
}, },
"prefix": "dist/topikm/qt5.6.3-win32-msvc2015/", "prefix": "dist/topikm/qt5.6.3-win32-msvc2015/",
...@@ -29,7 +30,7 @@ ...@@ -29,7 +30,7 @@
] ]
}, },
{ {
"name": "topikm6-topsys", "name": "usermgt",
"version": "6.1.63", "version": "6.1.63",
"os": "linux", "os": "linux",
"arch": "x64", "arch": "x64",
...@@ -38,6 +39,7 @@ ...@@ -38,6 +39,7 @@
"noqt": false, "noqt": false,
"devDependencies": { "devDependencies": {
"topikm6-frame": "^6.0.0", "topikm6-frame": "^6.0.0",
"topikm6-topsys": "^6.1.0",
"topikm6-templateclass": "^1.0.0" "topikm6-templateclass": "^1.0.0"
}, },
"prefix": "dist/topikm/qt5.6.3-linuxx86_64/", "prefix": "dist/topikm/qt5.6.3-linuxx86_64/",
...@@ -56,7 +58,7 @@ ...@@ -56,7 +58,7 @@
] ]
}, },
{ {
"name": "topikm6-topsys-debug", "name": "usermgt-debug",
"version": "6.1.63", "version": "6.1.63",
"os": "windows", "os": "windows",
"arch": "x86", "arch": "x86",
...@@ -65,6 +67,7 @@ ...@@ -65,6 +67,7 @@
"noqt": false, "noqt": false,
"devDependencies": { "devDependencies": {
"topikm6-frame-debug": "^6.0.0", "topikm6-frame-debug": "^6.0.0",
"topikm6-topsys-debug": "^6.1.0",
"topikm6-templateclass-debug": "^1.0.0" "topikm6-templateclass-debug": "^1.0.0"
}, },
"prefix": "dist/topikm/qt5.6.3-win32-msvc2015/", "prefix": "dist/topikm/qt5.6.3-win32-msvc2015/",
......
#include "custommoduleplugin.h" #include "custommoduleplugin.h"
#include "sysusermgt/musermgt.h" #include "sysusermgt/sysusermgt.h"
#include "sysmainwindow/msysmainwindow.h" //#include "sysmainwindow/msysmainwindow.h"
QStringList TopSysPlugin::getClassList() QStringList TopSysPlugin::getClassList()
{ {
return QStringList()<< QStringLiteral("Musermgt") return QStringList()<< QStringLiteral("Musermgt");
<< QStringLiteral("SysMainWindow");
} }
TopClassAbs *TopSysPlugin::newClass(const QString &iClassName, TopClassAbs *TopSysPlugin::newClass(const QString &iClassName,
const QString &iModuleName, const QString &iModuleName,
const QVariantMap &iUrlPars) const QVariantMap &iUrlPars)
{ {
if (iClassName == QStringLiteral("SysMainWindow")) { if (iClassName == QStringLiteral("Musermgt")) {
return new SysMainWindow(iModuleName, iUrlPars, nullptr);
} else if (iClassName == QStringLiteral("Musermgt")) {
return new Musermgt(iModuleName, iUrlPars, nullptr); return new Musermgt(iModuleName, iUrlPars, nullptr);
} }
return nullptr; return nullptr;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
# # # #
############################################################################# #############################################################################
TARGET = $$qtLibraryTarget(musermgt-plugin) TARGET = $$qtLibraryTarget(topikm6-custommodule-plugin)
QT += core sql widgets script network xml scripttools printsupport QT += core sql widgets script network xml scripttools printsupport
win32 { win32 {
...@@ -49,8 +49,6 @@ win32 { ...@@ -49,8 +49,6 @@ win32 {
LIBS += -ldbghelp LIBS += -ldbghelp
LIBS += -luser32 LIBS += -luser32
} }
include (sysmainwindow/sysmainwindow.pri)
include (sysusermgt/sysusermgt.pri) include (sysusermgt/sysusermgt.pri)
DIST_DIR = $$PWD/../../../dist DIST_DIR = $$PWD/../../../dist
...@@ -66,10 +64,6 @@ win32{ ...@@ -66,10 +64,6 @@ win32{
DESTDIR = $${DESTDIR}/plugins DESTDIR = $${DESTDIR}/plugins
} }
TRANSLATIONS += topikm6_topsys_zhcn.ts \
topikm6_topsys_en.ts \
topikm6_topsys_zhtw.ts
QM_LIST = $$PWD/*.qm QM_LIST = $$PWD/*.qm
DEST_LANGUAGE_PATH = $$system_path($${TOPIKM_SDKPATH}/language) DEST_LANGUAGE_PATH = $$system_path($${TOPIKM_SDKPATH}/language)
......
#include "msysmainwindow.h"
#include <QCloseEvent>
#include <QDesktopServices>
#include <QProcess>
#include <QGraphicsDropShadowEffect>
#include <QHBoxLayout>
#include <QMenu>
#include <QDateTime>
#include <QResource>
#include <QTabBar>
#include <QFileDialog>
#include <QFileInfo>
#include <QToolBar>
#include <QApplication>
#include <QVBoxLayout>
#include <QSplitter>
#include <QPainter>
#include <tbaseutil/tdataparse.h>
#include <tbaseutil/tfileio.h>
#include <tbaseutil/tlogger.h>
#include <tbaseutil/tresource.h>
#include <tbaseutil/ttheme.h>
#include <tdatabaseutil/tsqlqueryv2.h>
#include <tdatabaseutil/tsqlconnectionpoolv2.h>
#include <toputil/topaboutusdialog.h>
#include <topcore/topclasssqlthread.h>
#include <topcore/topcore.h>
#include <toputil/toploginpwdrestdialog.h>
#include <topcore/topmessagecontroller.h>
#include <twidget/tmessagebox.h>
#include <twidget/tpushbutton.h>
#include <twidget/tuiloaderdialog.h>
#include <twidget/tpanelmenu.h>
#include <twidget/twebview.h>
#include <twidget/ttoolbutton.h>
#include <twidget/tdialog.h>
#include <twidget/tradiobox.h>
#include <twidget/tcheckbox.h>
#include <twidget/tgroupbox.h>
#include <twidget/tdialogbuttonbox.h>
#include "topquickbutton.h"
#include "topquicktoolbar.h"
struct NaviData {
SysMainWindow::RouteType routeType = SysMainWindow::RouteType::None; // 路由类型
QVariant menuData; // 当类型为Menu时,缓存导航树的状态
};
SysMainWindow::SysMainWindow(const QString &iModuleNameStr,
const QVariantMap &iUrlPars,
QWidget *iParent)
: TopClassAbs(iParent)
{
initModule(iModuleNameStr, iUrlPars);
if (this->isHookExists("afterModuleInit")) {
this->callHooks("afterModuleInit");
}
setHasWindowTitleBar(false);
QStringList rccLst = config("resource.rcc").toStringList();
for (QString rcc : rccLst) {
TRES->loadRcc(rcc);
}
initNaviToolBar();
initMainWidget();
initDefaultRoute();
initIsPinned();
initSysTrayIcon();
mMessageController = new TopMessageController(this);
mMessageController->setParentWidget(this);
connect(APP, SIGNAL(notification(QString,QVariant,QString)), this, SLOT(onNotification(QString,QVariant,QString)));
setMinimumSize(TTHEME_DP(800), TTHEME_DP(600));
QVariantMap defalutSize = config("default_size").toMap();
if (!defalutSize.isEmpty() && defalutSize["width"].toInt() > 0
&& defalutSize["height"].toInt() > 0) {
resize(TTHEME_DP(defalutSize["width"].toInt()),
TTHEME_DP(defalutSize["height"].toInt()));
} else {
showMaximized();
}
refreshActionState();
bool hasOperateTimeOut = config("has_operate_time_out").toBool();
if (hasOperateTimeOut) {
mPreOperateTime = new QDateTime(QDateTime::currentDateTime());
mOperateTimeOutTimer = new QTimer(this);
mOperateTimeOutTimer->setInterval(1000);
connect(mOperateTimeOutTimer, SIGNAL(timeout()), this, SLOT(onOperateTimer()));
mOperateTimeOutTimer->start();
}
}
SysMainWindow::~SysMainWindow()
{
if (this->isHookExists("onDestory")) {
this->callHooks("onDestory");
}
}
void SysMainWindow::setIsPinned(bool iIsPinned, bool iForce)
{
if (!iForce) {
if (mIsPinned == iIsPinned) {
return;
}
}
mIsPinned = iIsPinned;
if (mIsPinned) {
QSize widgetSize = mPopupWidget->size();
qreal totalWidth = mMainWidget->width();
mPinButton->setIcon(TRES->icon("pin"));
// 导航窗体被钉住
// 将mNaviWidget添加到mCenterWidget
mPopupWidget->setWindowFlags(Qt::Widget);
mPopupWidget->setStretchWidgetVisible(false);
mCenterWidget->insertWidget(0, mPopupWidget);
mCenterWidget->setSizes(QList<int>()<<widgetSize.width()<<(totalWidth-widgetSize.width()));
} else {
mPinButton->setIcon(TRES->icon("pin2"));
// 导航窗体取消钉住
// 将mNaviWidget从mCenterWidget中移出
// 并将mNaviWidget设置成Popup, 设定mNaviWidget的位置
mPopupWidget->setParent(nullptr);
mPopupWidget->setWindowFlags(Qt::Popup);
mPopupWidget->setStretchWidgetVisible(true);
movePanelMenuWidget();
mPopupWidget->setVisible(true);
}
}
bool SysMainWindow::hide2SystemTrayState()
{
return mHidetoSysTray;
}
void SysMainWindow::saveHide2SystemTrayState(bool iState)
{
mHidetoSysTray = iState;
if (mHidetoSysTrayFlag) {
APP->saveSetting(mHidetoTrayRegName, QVariant::fromValue(mHidetoSysTray));
}
}
bool SysMainWindow::isSystemTrayIconShow()
{
return mSysTrayIconShow;
}
void SysMainWindow::initNaviToolBar()
{
mNaviToolBar = new TopQuickToolBar(this);
mNaviToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
mNaviToolBar->setOrientation(Qt::Vertical);
mNaviToolBar->setMovable(false);
mNaviToolBar->setStyleSheet(QString("QToolBar{border:solid; border-color:#D5D5D5; border-width:0px; border-right-width:0px; spacing:0px;padding:0px;background-color:%1;}").arg(TTHEME->value("COLOR_PRIMARY_7").toString()));
// 添加间隔
QWidget *spacingWget = new QWidget(this);
spacingWget->setFixedHeight(TTHEME_DP(56));
mNaviToolBar->addWidget(spacingWget);
// 添加配置的导航项
QVariantList naviLst = config("desktop").toMap().value("navi").toList();
for (QVariant var : naviLst) {
if (var.type() == QVariant::String) {
if (var.toString().toUpper() == "STRETCHER") {
QWidget *stretcher = new QWidget;
stretcher->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
mNaviToolBar->addWidget(stretcher);
}
} else {
QVariantMap navi = var.toMap();
TopQuickButton *btn = mNaviToolBar->addQuickButton(navi);
if (btn != nullptr) {
connect(btn, SIGNAL(clicked()), this, SLOT(onQuickBtnClicked()));
}
}
}
}
void SysMainWindow::initMainWidget()
{
QWidget *centerWidget = new QWidget(this);
mMainLayout = new QHBoxLayout(centerWidget);
mMainLayout->setSpacing(0);
mMainLayout->setMargin(0);
// 添加左侧导航工具条
if (mNaviToolBar != nullptr) {
mMainLayout->addWidget(mNaviToolBar);
}
//路由导航菜单
mPopupWidget = new StretchFrame(this);
mPopupWidget->setMinimumWidth(TTHEME_DP(config("navi.min_size.width", 200).toInt()));
mPopupWidget->setMaximumWidth(TTHEME_DP(500));
mPopupWidget->resize(TTHEME_DP(config("navi.min_size.width", 200).toInt()), mPopupWidget->height());
mPopupWidget->setVisible(false);
mPopupWidget->setGraphicsEffect(TTHEME->getShadowEffect(1, "left"));
QWidget *popupWidget = new QWidget(mPopupWidget);
QVBoxLayout *panelMenuMainLayout = new QVBoxLayout(popupWidget);
panelMenuMainLayout->setMargin(0);
panelMenuMainLayout->setSpacing(0);
QWidget *panelMenuHeaderWidget = new QWidget;
panelMenuHeaderWidget->setFixedHeight(TTHEME_DP(40));
panelMenuHeaderWidget->setStyleSheet("background-color:#E1E1E5;");
QHBoxLayout *panelMenuHeaderLayout = new QHBoxLayout(panelMenuHeaderWidget);
mPanelMenuTitleLabel = new QLabel;
panelMenuHeaderLayout->addWidget(mPanelMenuTitleLabel);
panelMenuHeaderLayout->addStretch(1);
mPinButton = new TToolButton(this);
connect(mPinButton, SIGNAL(clicked(bool)), this, SLOT(onPinButtonClicked()));
mPinButton->setIcon(TRES->icon(QString("pin")));
mPinButton->setTuiStyle("size=small");
panelMenuHeaderLayout->addWidget(mPinButton);
panelMenuMainLayout->addWidget(panelMenuHeaderWidget);
mModuleBarStackedWidget = new QStackedWidget(this);
mPanelMenu = new TPanelMenu(this);
connect(mPanelMenu, SIGNAL(clicked(QVariant)), this, SLOT(onPanelMenuClicked(QVariant)));
mModuleBarStackedWidget->addWidget(mPanelMenu);
panelMenuMainLayout->addWidget(mModuleBarStackedWidget);
mPopupWidget->setWidget(popupWidget);
// 添加右侧模块显示区域
mMainWidget = new QWidget(this);
QVBoxLayout *centerLayout = new QVBoxLayout(mMainWidget);
centerLayout->setSpacing(0);
centerLayout->setMargin(0);
mWindowTitleBar = new TFramelessWindowBar(this);
mWindowTitleBar->setHostWindow(this);
mWindowTitleBar->setAutoHideFlags(TFramelessWindowBar::AutoHideHint_SysButton);
mWindowTitleBar->setFixedHeight(TTHEME_DP(40));
QHBoxLayout *winTitleLayout = new QHBoxLayout(mWindowTitleBar);
winTitleLayout->setSpacing(0);
winTitleLayout->setMargin(0);
winTitleLayout->addSpacing(TTHEME_DP(12));
mTabBar = new QTabBar(this);
mTabBar->setProperty("SS_TYPE","PRIMARY");
mTabBar->setDrawBase(false);
winTitleLayout->addWidget(mTabBar, 0, Qt::AlignBottom);
winTitleLayout->addStretch(1);
winTitleLayout->addSpacing(TTHEME_DP(8));
QWidget *msgparent = new QWidget(this);
msgparent->setFixedWidth(TTHEME_DP(200));
winTitleLayout->addWidget(msgparent, 0);
mMessageLabel = new QLabel(msgparent);
mMessageLabel->setFixedWidth(TTHEME_DP(200));
mMessageLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
mMessageLabel->setProperty("SS_FONT", "12");
mMessageAnimation = new QPropertyAnimation(mMessageLabel, "pos", this);
mMessageAnimation->setEasingCurve(QEasingCurve::Linear);
winTitleLayout->addSpacing(TTHEME_DP(8));
winTitleLayout->addWidget(mWindowTitleBar->windowMinButton(), 0, Qt::AlignTop);
winTitleLayout->addWidget(mWindowTitleBar->windowMaxButton(), 0, Qt::AlignTop);
winTitleLayout->addWidget(mWindowTitleBar->windowNormalButton(), 0, Qt::AlignTop);
winTitleLayout->addWidget(mWindowTitleBar->windowCloseButton(), 0, Qt::AlignTop);
connect(mTabBar, SIGNAL(currentChanged(int)), this, SLOT(onTabBarCurrentChanged(int)));
connect(mTabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(onTabBarCloseRequested(int)));
centerLayout->addWidget(mWindowTitleBar);
mStackedWidget = new StackedWidget(this);
if (config("background_image_path").isValid()) {
QString fileName = APP->appPlatformPath()
+ "/" + config("background_image_path").toString();
if (QFile::exists(fileName)) {
mStackedWidget->setBackground(fileName);
} else {
TLOG_ERROR(ttr("Wrong background image path."));
}
}
mStackedWidget->setMouseTracking(true);
centerLayout->addWidget(mStackedWidget, 1);
mCenterWidget = new QSplitter(this);
mCenterWidget->addWidget(mMainWidget);
mCenterWidget->setChildrenCollapsible(false);
mMainLayout->addWidget(mCenterWidget);
setCentralWidget(centerWidget);
//如果直接加到naviBar上,图标的大小是随toolbar的设定,无法改变图标大小;
TToolButton *winIconBtn = new TToolButton(this);
if (!this->iconName().contains('.')){
winIconBtn->setIcon(TRES->icon(this->iconName() + ".white"));
} else {
winIconBtn->setIcon(TRES->icon(this->iconName()));
}
mWindowTitleBar->setEditableWidgets(QList<QWidget*>() << mPinButton << winIconBtn << mTabBar);
winIconBtn->setToolTip(QString("%1\n%2").arg(APP->userLogName()).arg(APP->httpUrl()));
winIconBtn->setFixedSize(TTHEME_DP(40),TTHEME_DP(41));
winIconBtn->setStyleSheet(QString("TToolButton{background-color: %1; border-width:0px; border-style:none; border-radius:0px}")
.arg(TTHEME->value("COLOR_PRIMARY_8").toString()));
winIconBtn->setIconSize(QSize(TTHEME_DP(32), TTHEME_DP(32)));
winIconBtn->move(TTHEME_DP(0), TTHEME_DP(0));
winIconBtn->raise();
}
void SysMainWindow::initDefaultRoute()
{
QVariantList naviLst = config("desktop").toMap().value("navi").toList();
QVariantMap defaultRouteItem = searchDefaultRoute(naviLst);
if (!defaultRouteItem.isEmpty()) {
QString routeTypeStr = defaultRouteItem.value("route_type").toString();
RouteType routeType = str2RouteType(routeTypeStr);
if (routeType == RouteType::Module) {
routeModule(defaultRouteItem.value("url_address").toString(), defaultRouteItem);
} else if (routeType == RouteType::Url) {
routeUrl(defaultRouteItem.value("url_address").toString(), defaultRouteItem);
}
}
}
void SysMainWindow::openModule(const QString &iUrl,
const QVariant &iConfig)
{
bool exists = false;
TopClassAbs *module = APP->openModule(iUrl, &exists);
if (module == nullptr) {
TLOG_ERROR(QString("open module(%1) failed.").arg(iUrl));
return;
}
// 默认将菜单中的标题、图标设置到模块
QVariantMap paramMap = iConfig.toMap();
QString title = paramMap.value("title_" + APP->language()).toString();
if (title.isEmpty()) {
title = paramMap.value("title").toString();
}
module->setTitle(title);
module->setIconName(paramMap.value("icon").toString());
const QString url = module->url().toUpper();
if (!exists) {
connect(module, SIGNAL(windowTitleChanged(QString)),
this, SLOT(onModuleWindowTitleChanged()),
Qt::UniqueConnection);
connect(module, SIGNAL(windowModifyChanged(bool)),
this, SLOT(onModuleWindowTitleChanged()),
Qt::UniqueConnection);
}
if (!mUrlAddressWidgetMap.contains(url)) {
mUrlAddressWidgetMap.insert(url, module);
mUrlAddressConfigMap.insert(url, iConfig.toMap());
}
QVariantMap config;
config.insert("title", module->title());
config.insert("icon", module->iconName());
mStackedWidget->addWidget(module);
mStackedWidget->setCurrentWidget(module);
updateTabBar(url, config);
}
void SysMainWindow::updateTabBar(const QString &iUrl, const QVariant &iConfigVar)
{
disconnect(mTabBar, 0, 0, 0);
bool exists = false;
int count = mTabBar->count();
for (int i = 0; i < count; ++i) {
if (iUrl == mTabBar->tabData(i).toString()) {
mTabBar->setCurrentIndex(i);
exists = true;
break;
}
}
if (!exists) {
QVariantMap configMap = iConfigVar.toMap();
QString iconStr = configMap.value("icon").toString();
int index = mTabBar->addTab(TRES->icon(iconStr, "TAB", "DARK"),
configMap.value("title").toString());
mTabBar->setTabData(index, iUrl);
mTabBar->setCurrentIndex(index);
}
connect(mTabBar, SIGNAL(currentChanged(int)), this, SLOT(onTabBarCurrentChanged(int)));
connect(mTabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(onTabBarCloseRequested(int)));
}
void SysMainWindow::updateTabBarWhenRemoveTab(int index)
{
if (index == mTabBar->currentIndex()) {
int previous = index - 1;
if (previous >= 0) {
QString previousUrl = mTabBar->tabData(previous).toString();
QWidget *widget = mUrlAddressWidgetMap.value(previousUrl);
if (widget != nullptr) {
mStackedWidget->setCurrentWidget(widget);
}
} else {
int next = index + 1;
if (next < mTabBar->count()) {
QString nextUrl = mTabBar->tabData(next).toString();
QWidget *widget = mUrlAddressWidgetMap.value(nextUrl);
if (widget != nullptr) {
mStackedWidget->setCurrentWidget(widget);
}
} else {
}
}
}
mTabBar->removeTab(index);
update();
}
void SysMainWindow::updatePopupWidget(TopQuickButton *iBtn, const QVariantMap &iConfigVar, RouteType type)
{
if (iBtn == nullptr) {
return;
}
const QString lang = APP->language();
QString title = iConfigVar.value("title_"+lang).toString();
if (title.isEmpty()) {
title = iConfigVar.value("title").toString();
}
mPanelMenuTitleLabel->setText(title);
if (type == RouteType::Menu) {
if (mNaviDataMap[iBtn]->menuData.isNull()) {
QVariantList data = iConfigVar.value("items").toList();
QString status = config("navi_status_without_permission").toString();
if (status == "disable" || status == "hide") {
insertStatusInfo(data);
}
buildPanelMenuData(data);
mNaviDataMap[iBtn]->menuData = data;
mPanelMenu->setItemList(data);
} else {
mPanelMenu->setItemList(mNaviDataMap[iBtn]->menuData);
}
mModuleBarStackedWidget->setCurrentWidget(mPanelMenu);
} else if (type == RouteType::ModuleBar) {
QString url = iConfigVar.value("url_address").toString().trimmed().toUpper();
TopClassAbs *module = nullptr;
if (mModuleBarUrlAddressMap.contains(url)) {
module = mModuleBarUrlAddressMap[url];
} else {
module = APP->openModule(url);
}
if (module != nullptr) {
mModuleBarUrlAddressMap[url] = module;
mModuleBarStackedWidget->addWidget(module);
mModuleBarStackedWidget->setCurrentWidget(module);
}
}
}
void SysMainWindow::movePanelMenuWidget()
{
if (mPopupWidget != nullptr && (!mIsPinned)) {
auto geometry = this->geometry();
QRect rect(geometry.x() + mNaviToolBar->width(),
geometry.y(),
mPopupWidget->width(),
geometry.height());
if (!this->isMaximized()) {
auto frameGeometry = this->frameGeometry();
rect.setX(frameGeometry.x() + mNaviToolBar->width());
rect.setY(frameGeometry.y() + 1);
rect.setHeight(frameGeometry.height() - 3);
}
mPopupWidget->setGeometry(rect);
}
}
void SysMainWindow::initSysTrayIcon()
{
mHidetoTrayRegName = APP->productCategory();
if (mHidetoTrayRegName.isEmpty()) {
mHidetoTrayRegName = "TopLinker/SysMainWindow/HidetoSysTray";
} else {
mHidetoTrayRegName = "TopLinker/" + mHidetoTrayRegName + "/HidetoSysTray";
}
mSysTrayTitle = config("sys_tray_product_name").toString();
if (mSysTrayTitle.isEmpty()) {
mSysTrayTitle = config("sys_title").toString();
}
mHidetoSysTrayFlag = true;
if (APP->getSetting(mHidetoTrayRegName).toString().isEmpty()) {
mHidetoSysTrayFlag = false;
}
mHidetoSysTray = APP->getSetting(mHidetoTrayRegName, false).toBool();
mSysTrayIconShow = config("sys_tray_icon_show", false).toBool();
if (mSysTrayIconShow == false) {
mHidetoSysTrayFlag = false;
}
mSysTrayIcon = new QSystemTrayIcon(this);
QString sysIcon = config("sys_icon").toString();
if (sysIcon.isEmpty()) {
sysIcon = "topmes.#0162fe";
} else if (sysIcon.contains(".")) {
sysIcon = sysIcon.split(".").first() + ".#0162fe";
} else {
sysIcon += ".#0162fe";
}
mSysTrayIcon->setIcon(TRES->colorIcon(sysIcon));
mSysTrayIcon->setToolTip(this->title());
QMenu *trayMenu = new QMenu;
trayMenu->setStyleSheet("QMenu::item{padding-top: 0px;}");
trayMenu->addAction(ttr("Open") + mSysTrayTitle, [this]{
this->show();
this->activateWindow();
});
trayMenu->addAction(TRES->colorIcon("power-off.#e54545"),ttr("Quit"), [this]{
mSysTrayIcon->deleteLater();
QApplication::exit();
});
mSysTrayIcon->setContextMenu(trayMenu);
connect(mSysTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
this, SLOT(onSysTrayIconActived(QSystemTrayIcon::ActivationReason)));
if (mSysTrayIconShow) {
mSysTrayIcon->show();
} else {
mSysTrayIcon->hide();
}
}
SysMainWindow::RouteType SysMainWindow::str2RouteType(const QString &iTypeStr)
{
if (iTypeStr == "module") {
return RouteType::Module;
} else if (iTypeStr == "menu") {
return RouteType::Menu;
} else if (iTypeStr == "module_bar") {
return RouteType::ModuleBar;
} else if (iTypeStr == "action") {
return RouteType::Action;
} else if (iTypeStr == "url") {
return RouteType::Url;
} else {
return RouteType::None;
}
}
void SysMainWindow::routeUrl(const QString &iUrlAddressStr, const QVariantMap &iConfigVar)
{
if (!iUrlAddressStr.isEmpty()) {
if (mUrlAddressWidgetMap.contains(iUrlAddressStr)) {
QWidget *widget = mUrlAddressWidgetMap.value(iUrlAddressStr);
TWebView *webview = qobject_cast<TWebView *>(widget);
if (webview != nullptr) {
mStackedWidget->setCurrentWidget(widget);
updateTabBar(iUrlAddressStr);
webview->navigate(iUrlAddressStr);
}
} else {
TWebView *webview = new TWebView(this);
webview->setAttribute(Qt::WA_DeleteOnClose);
mUrlAddressWidgetMap.insert(iUrlAddressStr, webview);
mUrlAddressConfigMap.insert(iUrlAddressStr, iConfigVar);
QString title = iConfigVar.value("title_"+APP->language()).toString();
if (title.isEmpty()) {
title = iConfigVar.value("title").toString();
}
QVariantMap tmp;
tmp.insert("title", title);
tmp.insert("icon", iConfigVar.value("icon"));
mStackedWidget->addWidget(webview);
mStackedWidget->setCurrentWidget(webview);
updateTabBar(iUrlAddressStr, tmp);
webview->navigate(iUrlAddressStr);
}
}
}
void SysMainWindow::routeModule(const QString &iUrlAddressStr, const QVariantMap &iConfigVar)
{
if (mIsRoutingModule) {
return;
}
mIsRoutingModule = true;
if (!iUrlAddressStr.isEmpty()) {
if (mUrlAddressWidgetMap.contains(iUrlAddressStr)) {
QWidget *widget = mUrlAddressWidgetMap.value(iUrlAddressStr);
if (widget != nullptr) {
mStackedWidget->setCurrentWidget(widget);
updateTabBar(iUrlAddressStr);
}
} else {
openModule(iUrlAddressStr, iConfigVar);
}
}
mIsRoutingModule = false;
}
void SysMainWindow::routeAction(const QString &iUrlAddressStr)
{
callAction(iUrlAddressStr);
}
void SysMainWindow::route(TopQuickButton *iBtn, NaviData *iData, const QVariantMap &iConfigVar)
{
RouteType type = iData->routeType;
if (type == RouteType::Module) {
mPopupWidget->setVisible(false);
QString urlAddress = iConfigVar.value("url_address").toString().trimmed().toUpper();
routeModule(urlAddress, iConfigVar);
} else if (type == RouteType::Menu || type == RouteType::ModuleBar) {
movePanelMenuWidget();
if (mCurrentActiveQuickBtn == iBtn) {
mPopupWidget->setVisible(!mPopupWidget->isVisible());
} else {
if (!mPopupWidget->isVisible()) {
mPopupWidget->setVisible(true);
}
}
updatePopupWidget(iBtn, iConfigVar, type);
} else if (type == RouteType::Action) {
QString urlAddress = iConfigVar.value("url_address").toString().trimmed();
routeAction(urlAddress);
} else if (type == RouteType::Url) {
mPopupWidget->setVisible(false);
QString urlAddress = iConfigVar.value("url_address").toString().trimmed();
routeUrl(urlAddress, iConfigVar);
} else {
return;
}
if (mCurrentActiveQuickBtn != nullptr) {
mCurrentActiveQuickBtn->setActived(false);
}
iBtn->setActived(true);
mCurrentActiveQuickBtn = iBtn;
}
void SysMainWindow::insertStatusInfo(QVariantList &oMenuDataLst)
{
QVariantMap urlMap = getUrlAddressInfo(oMenuDataLst);
QStringList moduleList = urlMap["module"].toStringList();
QStringList actionList = urlMap["action"].toStringList();
TSqlQueryV2 localSqlQuery(T_SQLCNT_POOL->getSqlDatabase(LOCALDB_CONNECTION_NAME));
QVariantMap modulePermission;
QVariantMap actionPermission;
if (moduleList.count() > 0) {
TSqlSelectorV2 selector;
selector.setTable("sys_setting_module");
selector.setField("module_name,conf");
selector.addWhere("product_category", APP->productCategory());
selector.addWhere("module_name", moduleList);
selector.setFieldFormat("conf", "json");
QVariantList moduleInfoList = localSqlQuery.selectArrayMap(selector);
for (QVariant val: moduleInfoList) {
QVariantMap dataMap = val.toMap();
modulePermission[dataMap["module_name"].toString().toLower()] = dataMap["conf"].toMap()["sys_open_right"];
}
}
if (actionList.count() > 0) {
TSqlSelectorV2 selector;
selector.setTable("sys_setting_action");
selector.setField("action_name,attr");
selector.addWhere("module_name", moduleName());
selector.addWhere("action_name", actionList);
selector.setFieldFormat("attr", "json");
QVariantList actionInfoList = localSqlQuery.selectArrayMap(selector);
for (QVariant val: actionInfoList) {
QVariantMap dataMap = val.toMap();
actionPermission[dataMap["action_name"].toString().toLower()] = dataMap["attr"].toMap()["PERMISSION"];
}
}
insertStatusInfo(oMenuDataLst, modulePermission, actionPermission);
}
void SysMainWindow::insertStatusInfo(QVariantList &oMenuDataLst, const QVariantMap &iModulePermission, const QVariantMap &iActionPermission)
{
QString status = config("navi_status_without_permission").toString();
if (status.isEmpty() || status == "show") {
return;
}
for (QVariant & i : oMenuDataLst) {
QVariantMap dataMap = i.toMap();
QString routeType = dataMap["route_type"].toString().trimmed().toLower();
QString url = dataMap["url_address"].toString().trimmed().toLower();
QString permission;
if (routeType == "module") {
permission = iModulePermission[url].toString();
} else if (routeType == "action") {
permission = iActionPermission[url].toString();
}
if (!permission.isEmpty()) {
if (!APP->hasRight(permission)) {
dataMap["status"] = status;
}
}
QVariantList items = dataMap["items"].toList();
if (items.count() > 0) {
insertStatusInfo(items, iModulePermission, iActionPermission);
dataMap["items"] = items;
}
i = dataMap;
}
}
QVariantMap SysMainWindow::getUrlAddressInfo(const QVariantList &iMenuDataLst)
{
QStringList moduleList;
QStringList actionList;
for (QVariant i : iMenuDataLst) {
QVariantMap dataMap = i.toMap();
QVariantList items = dataMap["items"].toList();
if (items.count() > 0) {
QVariantMap urlInfo = getUrlAddressInfo(items);
moduleList.append(urlInfo["module"].toStringList());
actionList.append(urlInfo["action"].toStringList());
}
QString routeType = dataMap["route_type"].toString();
if (routeType == "module") {
moduleList.append(dataMap["url_address"].toString().trimmed().toUpper());
} else if (routeType == "action") {
actionList.append(dataMap["url_address"].toString().trimmed());
}
}
return QVariantMap{{"module", moduleList},{"action",actionList}};
}
bool SysMainWindow::nativeEvent(const QByteArray &iEventTypeLst,
void *iMsgPtr,
long *oResultI64Ptr)
{
#ifdef Q_OS_WIN
if (mWindowTitleBar != nullptr) {
MSG* msg = static_cast<MSG *>(iMsgPtr);
if (mWindowTitleBar->winEvent(msg, oResultI64Ptr)) {
return true;
}
}
#endif
return QMainWindow::nativeEvent(iEventTypeLst, iMsgPtr, oResultI64Ptr);
}
void SysMainWindow::closeEvent(QCloseEvent *iEvent)
{
if (!mSysTrayIconShow) {
if (TMessageBox::msgbox(this, ttr("Are you sure to quit?"), "", "Question", ttr("Quit"),
QStringList() << ttr("Quit") + ":Yes:Accept:Warn"
<< ttr("Cancel") + ":Cancel:Reject:Normal",
"Cancel") == "Yes") {
iEvent->accept();
} else {
iEvent->ignore();
}
return;
}
if (mHidetoSysTrayFlag) {
if (mHidetoSysTray) {
this->hide();
iEvent->ignore();
} else {
iEvent->accept();
}
} else {
this->showCloseDialog();
iEvent->ignore();
}
}
void SysMainWindow::onOperateTimer()
{
QDateTime *nowTime = new QDateTime(QDateTime::currentDateTime());
mNowWindowHideState = this->isHidden();
if (mPreWindowHideState != mNowWindowHideState) {
mPreOperateTime = nowTime;
mPreWindowHideState = mNowWindowHideState;
}
mNowWindowActiveState = this->isActiveWindow();
//若窗体为当前窗体,则根据鼠标位置来判断是否操作
if (mNowWindowActiveState) {
mNowMousePos = QCursor::pos();
if (mPreMousePos != mNowMousePos) {
mPreOperateTime = nowTime;
mPreMousePos = mNowMousePos;
}
}
if (mPreWindowActiveState != mNowWindowActiveState) {
mPreOperateTime = nowTime;
mPreWindowActiveState = mNowWindowActiveState;
}
QVariantMap timeOutMap = config("operate_out_time").toMap();
int hour = timeOutMap.value("hour").toInt();
int minute = timeOutMap.value("minute").toInt();
int second = timeOutMap.value("second").toInt();
int allSec = hour*60*60 + minute*60 + second;
if (qAbs(nowTime->secsTo(*mPreOperateTime)) >= allSec) {
mPreOperateTime = nowTime;
if ("Yes" == TMessageBox::warning(this, ttr("Operate TimeOut!"), ttr("Operate TimeOut!Please restart the application to update!")
,"",QStringList() << ttr("Confirm")+":Yes:Yes:Primary" << ttr("Cancel")+":Cancel:Cancel:Normal")) {
this->close();
};
}
}
void SysMainWindow::onQuickBtnClicked()
{
if (TopQuickButton *btn = qobject_cast<TopQuickButton *>(sender())) {
if (mNaviDataMap.contains(mCurrentActiveQuickBtn) && (mNaviDataMap[mCurrentActiveQuickBtn]->routeType == RouteType::Menu)) {
mNaviDataMap[mCurrentActiveQuickBtn]->menuData = mPanelMenu->itemList();
}
QVariantMap config = btn->data().toMap();
if (mNaviDataMap.contains(btn)) {
NaviData *productData = mNaviDataMap.value(btn);
route(btn, productData, config);
} else {
NaviData *productData = new NaviData;
productData->routeType = str2RouteType(config.value("route_type").toString());
mNaviDataMap.insert(btn, productData);
route(btn, productData, config);
}
}
}
void SysMainWindow::onTabBarCurrentChanged(int iIndexInt)
{
QString url = mTabBar->tabData(iIndexInt).toString();
QWidget *widget = mUrlAddressWidgetMap.value(url);
if (widget != nullptr) {
mStackedWidget->setCurrentWidget(widget);
}
}
void SysMainWindow::onTabBarCloseRequested(int iIndexInt)
{
QString url = mTabBar->tabData(iIndexInt).toString();
QWidget *widget = mUrlAddressWidgetMap.value(url);
if (widget != nullptr) {
if (widget->close()) {
mUrlAddressWidgetMap.remove(url);
mUrlAddressConfigMap.remove(url);
updateTabBarWhenRemoveTab(iIndexInt);
}
}
}
void SysMainWindow::onNaviButtonClicked()
{
if (TPushButton *btn = qobject_cast<TPushButton *>(sender())) {
openModule(btn->data().toMap().value("urlAddress").toString(), btn->data());
}
}
void SysMainWindow::onPinButtonClicked()
{
setIsPinned(!mIsPinned);
}
void SysMainWindow::onPanelMenuClicked(const QVariant &iDataVar)
{
QVariantMap dataMap = iDataVar.toMap();
dataMap.insert("title", dataMap.value("text"));
QVariantMap userData = dataMap.value("user_data").toMap();
QString routeTypeStr = userData.value("route_type").toString();
RouteType routeType = str2RouteType(routeTypeStr);
QString urlAddress = userData.value("url_address").toString();
bool routeSuccessBol = false;
if (routeType == RouteType::Module) {
routeSuccessBol = true;
routeModule(urlAddress, dataMap);
} else if (routeType == RouteType::Action) {
routeSuccessBol = true;
routeAction(urlAddress);
} else if(routeType == RouteType::Url) {
routeSuccessBol = true;
routeUrl(urlAddress, dataMap);
}
if (!mIsPinned && routeSuccessBol) {
mPopupWidget->setVisible(false);
}
}
void SysMainWindow::onNotification(const QString &iKeyStr, const QVariant &iDataVar, const QString &iUuid)
{
Q_UNUSED(iUuid);
if (qobject_cast<TopCore *>(sender()) != nullptr) {
if (iKeyStr == A_MESSAGECONTROLLER_SHOWOK
|| iKeyStr == A_MESSAGECONTROLLER_SHOWWARN
|| iKeyStr == A_MESSAGECONTROLLER_SHOWINFO) {
QString msgText = iDataVar.toMap().value("text").toString();
msgText = fontMetrics().elidedText(msgText, Qt::ElideMiddle, mMessageLabel->width());
mMessageLabel->setText(msgText);
QString color;
if (iKeyStr == A_MESSAGECONTROLLER_SHOWOK) {
color = "OK";
} else if (iKeyStr == A_MESSAGECONTROLLER_SHOWWARN) {
color = "WARN";
} else if (iKeyStr == A_MESSAGECONTROLLER_SHOWINFO) {
color = "INFO";
}
mMessageLabel->setProperty("SS_COLOR", color);
mMessageLabel->setStyleSheet(".Q{}");
mMessageAnimation->setDuration(3000);
mMessageAnimation->setStartValue(QPoint(0, TTHEME_DP(40)));
mMessageAnimation->setEndValue(QPoint(0, -mMessageLabel->height()));
mMessageAnimation->start();
} else if (iKeyStr == A_MESSAGECONTROLLER_SHOWERROR
|| iKeyStr == A_MESSAGECONTROLLER_LOADING
|| iKeyStr == A_MESSAGECONTROLLER_UNLOADING) {
if (mMessageController != nullptr) {
mMessageController->onNotifaction(iKeyStr, iDataVar);
}
} else if (iKeyStr == A_CORE_PUSH_MODULE_TO_DESKTOP) {
if (iDataVar.type() == QVariant::Map) {
QVariantMap param = iDataVar.toMap();
TopClassAbs *module = APP->getModule(param.value("moduleName").toString(),
param.value("uid").toString());
if (module != nullptr) {
const QString url = QString("%1/%2").arg(module->moduleName().toUpper()).arg(module->uid());
QVariantMap config;
config.insert("title", module->windowTitle());
config.insert("icon", module->iconName());
config.insert("url_address", url);
if (!mUrlAddressWidgetMap.contains(url)) {
mUrlAddressWidgetMap.insert(url, module);
mUrlAddressConfigMap.insert(url, config);
}
mStackedWidget->addWidget(module);
mStackedWidget->setCurrentWidget(module);
updateTabBar(url, config);
}
}
} else if (iKeyStr == A_CORE_OPEN_MODULE_TO_DESKTOP) {
TopClassAbs *module = nullptr;
if (iDataVar.type() == QVariant::Map) {
QVariantMap param = iDataVar.toMap();
module = APP->openModule(QString("%1/%2")
.arg(param.value("moduleName").toString())
.arg(param.value("uid").toString()));
} else if (iDataVar.type() == QVariant::String) {
module = APP->openModule(iDataVar.toString());
}
if (module != nullptr) {
connect(module, SIGNAL(windowTitleChanged(QString)), this, SLOT(onModuleWindowTitleChanged()), Qt::UniqueConnection);
connect(module, SIGNAL(windowModifyChanged(bool)), this, SLOT(onModuleWindowTitleChanged()), Qt::UniqueConnection);
const QString url = QString("%1%2")
.arg(module->moduleName())
.arg(module->uid().isEmpty() ? "" : ("/"+module->uid()));
QVariantMap config;
if (module->uid().isEmpty()) {
config.insert("title", module->title());
} else {
config.insert("title", module->windowTitle());
}
config.insert("icon", module->iconName());
config.insert("url_address", url);
if (!mUrlAddressWidgetMap.contains(url)) {
mUrlAddressWidgetMap.insert(url, module);
mUrlAddressConfigMap.insert(url, config);
mStackedWidget->addWidget(module);
}
mStackedWidget->setCurrentWidget(module);
updateTabBar(url, config);
}
} else if (iKeyStr == "mainwindow_show_other") {
QString modulePath = iDataVar.toString().trimmed();
QRegularExpression re("^(?<path>[^/]+/?[^,]*).*$");
QRegularExpressionMatch match = re.match(modulePath);
if (match.hasMatch()) {
modulePath = match.captured("path");
}
for (int i = 0; i < mTabBar->count(); ++i) {
if (mTabBar->tabData(i).toString().toUpper() == modulePath.toUpper()) {
mTabBar->setCurrentIndex(i);
break;
}
}
} else if (iKeyStr == "mainwindow_close_tab") {
QString tmpUrl;
QString tmpUid;
if (iDataVar.type() == QVariant::Map) {
QVariantMap param = iDataVar.toMap();
tmpUrl = param.value("moduleName").toString();
tmpUid = param.value("uid").toString();
tmpUrl = QString("%1%2").arg(tmpUrl).arg(tmpUid.isEmpty() ? "" : ("/"+tmpUid));
} else if (iDataVar.type() == QVariant::String) {
tmpUrl = iDataVar.toString();
}
if (!tmpUrl.isEmpty()) {
int tmpIndex = -1;
for (int i = 0; i < mTabBar->count(); ++i) {
if (mTabBar->tabData(i).toString().toUpper() == tmpUrl.toUpper()) {
tmpIndex = i;
break;
}
}
QWidget *widget = mUrlAddressWidgetMap.value(tmpUrl);
if (widget == nullptr) {
tmpUrl = tmpUrl.toUpper();
widget = mUrlAddressWidgetMap.value(tmpUrl);
}
if (widget != nullptr) {
if (widget->close()) {
mUrlAddressWidgetMap.remove(tmpUrl);
mUrlAddressConfigMap.remove(tmpUrl);
updateTabBarWhenRemoveTab(tmpIndex);
}
}
}
}
}
}
void SysMainWindow::onModuleWindowTitleChanged()
{
if (TopClassAbs *module = qobject_cast<TopClassAbs*>(sender())) {
QString url = QString("%1/%2").arg(module->moduleName().toUpper()).arg(module->uid());
int count = mTabBar->count();
for (int i = 0; i < count; ++i) {
if (url == mTabBar->tabData(i).toString()) {
mTabBar->setTabText(i, module->title() + (module->isDataModified() ? "*" : ""));
}
}
}
}
void SysMainWindow::onSysTrayIconActived(QSystemTrayIcon::ActivationReason reason)
{
if (QSystemTrayIcon::Trigger == reason) {
this->show();
this->activateWindow();
}
}
void SysMainWindow::initIsPinned()
{
setIsPinned(false, true);
}
void SysMainWindow::buildPanelMenuData(QVariantList &oMenuDataLst)
{
const QString lang = APP->language();
for (QVariant & i : oMenuDataLst) {
QVariantMap imap = i.toMap();
QVariantMap tmp;
QString title = imap.value("title_"+lang).toString();
if (title.isEmpty()) {
title = imap.value("title").toString();
}
bool isExpanded = false;
if (imap.contains("is_expanded")) {
isExpanded = imap.value("is_expanded").toBool();
}
tmp.insert("text", title);
tmp.insert("icon", imap.value("icon"));
tmp.insert("status", imap.value("status"));
tmp.insert("unfold", isExpanded);
QVariantMap userData;
userData.insert("url_address", imap.value("url_address"));
userData.insert("route_type", imap.value("route_type"));
tmp.insert("user_data", userData);
if (imap.contains("items")) {
QVariantList items = imap.value("items").toList();
buildPanelMenuData(items);
tmp.insert("child_list", items);
}
i = tmp;
}
}
QVariantMap SysMainWindow::searchDefaultRoute(const QVariantList &iNaviLst)
{
for (QVariant i : iNaviLst) {
QVariantMap imap = i.toMap();
if (imap.contains("default_route")) {
QVariant defaultRouteVar = imap.value("default_route");
if ((defaultRouteVar.type() == QVariant::Bool) && (defaultRouteVar.toBool())) {
return imap;
}
}
if (imap.contains("items")) {
QVariantMap ret = searchDefaultRoute(imap.value("items").toList());
if (!ret.isEmpty()) {
return ret;
}
}
}
return QVariantMap();
}
void SysMainWindow::showCloseDialog()
{
TDialog *closeDlg = new TDialog(this);
TFramelessWindowBar *winTitleBar = closeDlg->windowTitleBar();
winTitleBar->setAutoHideFlags(TFramelessWindowBar::AutoHideHint_All);
winTitleBar->setFixedHeight(TTHEME_DP(28));
QHBoxLayout *titleVLayout = new QHBoxLayout(winTitleBar);
titleVLayout->setSpacing(0);
titleVLayout->setMargin(0);
titleVLayout->addSpacing(TTHEME_DP(8));
titleVLayout->addWidget(winTitleBar->windowTitleLabel());
titleVLayout->addStretch(1);
titleVLayout->addWidget(winTitleBar->windowCloseButton());
closeDlg->setWindowTitle(ttr("Quit"));
QVBoxLayout *vlayout = new QVBoxLayout(closeDlg);
vlayout->setContentsMargins(10, 22, 10, 18);
vlayout->setSpacing(12);
QLabel *textLabel = new QLabel;
textLabel->setProperty("SS_FONT", "16");
textLabel->setProperty("SS_COLOR", QVariant("WARN"));
textLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
textLabel->setWordWrap(true);
textLabel->setText(ttr("Are you sure to quit?"));
vlayout->addWidget(textLabel);
vlayout->addStretch();
TRadioBox *radioBox = new TRadioBox;
QVariantList itemList;
QVariantMap itemHide;
itemHide.insert("name", "hide");
itemHide.insert("text", ttr("Hide to system tray"));
QVariantMap itemQuit;
itemQuit.insert("name", "quit");
itemQuit.insert("text", ttr("Quit"));
itemList.append(itemHide);
itemList.append(itemQuit);
radioBox->setItemList(itemList);
if (mHidetoSysTray) {
radioBox->setCurrentName("hide");
} else {
radioBox->setCurrentName("quit");
}
TCheckBox *checkbox = new TCheckBox;
checkbox->setText(ttr("No longer remind"));
QHBoxLayout *hlayout = new QHBoxLayout;
hlayout->addStretch();
hlayout->addWidget(radioBox);
hlayout->addStretch();
hlayout->addWidget(checkbox);
hlayout->addStretch();
vlayout->addLayout(hlayout);
vlayout->addStretch();
QWidget *line = new QWidget;
line->setFixedHeight(1);
line->setStyleSheet(QString("background-color:%1;").arg(TTHEME->value("COLOR_LIGHT_BORDER").toString()));
vlayout->addWidget(line);
TDialogButtonBox *buttonBox = new TDialogButtonBox;
buttonBox->setContentsMargins(1, 1, 1, 1);
buttonBox->findChild<QHBoxLayout*>()->setSpacing(16);
buttonBox->setCenterButtons(true);
buttonBox->setButtons(QStringList() << ttr("Ok")+":Ok:Accept:Warn"<<ttr("Cancel")+":Cancel:Reject:Normal");
vlayout->addWidget(buttonBox);
connect(buttonBox, SIGNAL(rejected()), closeDlg, SLOT(reject()));
connect(buttonBox, SIGNAL(accepted()), closeDlg, SLOT(accept()));
closeDlg->setFixedSize(420, 210);
int ret = closeDlg->exec();
if (radioBox->currentName() == "hide") {
mHidetoSysTray = true;
} else {
mHidetoSysTray = false;
}
if (checkbox->isChecked()) {
mHidetoSysTrayFlag = true;
APP->saveSetting(mHidetoTrayRegName, QVariant::fromValue(mHidetoSysTray));
}
if (ret == 1) {
if (radioBox->currentName() == "hide") {
this->hide();
} else {
mSysTrayIcon->deleteLater();
QApplication::exit();
}
}
}
void SysMainWindow::showPasswordModificationDialog()
{
TopLoginPwdRestDialog dialog;
dialog.exec();
}
void SysMainWindow::showAboutDialog()
{
TopAboutUsDialog dialog;
const QString lang = APP->language();
QVariantMap aboutCfg = config("about_us").toMap();
QString title = aboutCfg.value("title_"+lang).toString();
if (title.isEmpty()) title = aboutCfg.value("title").toString();
if (title.isEmpty()) {
title = this->windowTitle();
if (!config("product_version").toString().isEmpty()) {
title += config("product_version").toString();
}
}
dialog.setWindowTitle(title);
QString copyright = aboutCfg.value("copyright_" + lang).toString();
if (copyright.isEmpty()) {
copyright = aboutCfg.value("copyright").toString();
}
QString lawdesc = aboutCfg.value("lawdesc_" + lang).toString();
if (lawdesc.isEmpty()) {
lawdesc = aboutCfg.value("lawdesc").toString();
}
dialog.exec();
}
void SysMainWindow::openModuleUpgrade()
{
#ifdef Q_OS_WIN
const QString exeFileStr = APP->appBinPath() + "/TopModuleUpgrade.exe";
const QString exeFileStrNew = APP->appBinPath() + "/PackageUploaderPlus.exe";
#else
const QString exeFileStr = APP->appBinPath() + "/TopModuleUpgrade";
const QString exeFileStrNew = APP->appBinPath() + "/PackageUploaderPlus";
#endif
QFileInfo finfo(exeFileStrNew);
if (finfo.exists()) {
QProcess::startDetached(exeFileStrNew, QStringList()<<"-l"<<APP->language(), APP->appBinPath());
} else {
QDesktopServices::openUrl(QUrl::fromLocalFile(exeFileStr));
}
}
StretchFrame::StretchFrame(QWidget *iParent)
:QFrame(iParent)
{
setAttribute(Qt::WA_Hover, true);
setMouseTracking(true);
mStretchWidgetWidth = TTHEME_DP(5);
mLayout = new QHBoxLayout(this);
mLayout->setMargin(0);
mLayout->setSpacing(0);
mStretchWidget = new QFrame(this);
mStretchWidget->setFixedWidth(mStretchWidgetWidth);
mStretchWidget->setStyleSheet("background-color: rgba(0,0,0,0)");
}
void StretchFrame::setWidget(QWidget *iWidget)
{
if (mWidget != nullptr) {
delete mWidget;
}
mWidget = iWidget;
mLayout->insertWidget(0, mWidget);
}
void StretchFrame::setStretchWidgetVisible(bool iVisible)
{
mStretchWidget->setVisible(iVisible);
}
void StretchFrame::mousePressEvent(QMouseEvent *event)
{
if (this->isTopLevel() && event->button() == Qt::LeftButton){
mDragPosition = event->globalPos() - this->frameGeometry().topLeft();
mLeftButtonPressed = true;
}
QFrame::mousePressEvent(event);
}
void StretchFrame::mouseReleaseEvent(QMouseEvent *)
{
mLeftButtonPressed = false;
}
bool StretchFrame::event(QEvent *event)
{
if (event->type() == QEvent::HoverMove) {
QHoverEvent *hoverEvent = static_cast<QHoverEvent *>(event);
QPoint pos = hoverEvent->pos();
QPoint gp = mapToGlobal(pos);
if (hoverEvent && !mLeftButtonPressed && (windowFlags() & Qt::Popup)) {
QPoint br = QPoint(this->width(), this->height());
int x = pos.x();
bool widthReizable = (this->minimumWidth() != this->maximumWidth());
if (x < br.x() && x >= br.x() - mStretchWidgetWidth && widthReizable) {
if (cursor().shape() != Qt::SizeHorCursor) {
QApplication::setOverrideCursor(QCursor(Qt::SizeHorCursor));
setCursor(QCursor(Qt::SizeHorCursor));
}
} else if (cursor().shape() != Qt::ArrowCursor) {
QApplication::restoreOverrideCursor();
setCursor(QCursor(Qt::ArrowCursor));
}
} else if (mLeftButtonPressed && (cursor().shape() == Qt::SizeHorCursor)) {
QRect rect = this->rect();
QPoint tl = mapToGlobal(rect.topLeft()); //top left
QPoint br = mapToGlobal(rect.bottomRight()); //bottom right
QRect rectMove(tl, br);
if (gp.x() - tl.x() > minimumWidth()){
rectMove.setWidth(gp.x() - tl.x());
}
this->setGeometry(rectMove);
}
} else if (event->type() == QEvent::Resize) {
if (mWidget != nullptr) {
qreal width = size().width();
qreal height = size().height();
mWidget->resize(width, height);
}
const QRect rect = geometry();
mStretchWidget->setGeometry((rect.width() - mStretchWidgetWidth),
0, mStretchWidgetWidth, rect.height());
mStretchWidget->raise();
} else if (event->type() == QEvent::Hide) {
mLeftButtonPressed = false;
QApplication::restoreOverrideCursor();
} else if (event->type() == QEvent::Show) {
setFocus();
}
return QFrame::event(event);
}
void StretchFrame::showEvent(QShowEvent *event)
{
QFrame::showEvent(event);
activateWindow();
}
StackedWidget::StackedWidget(QWidget *iParent)
: QStackedWidget(iParent)
{
}
void StackedWidget::setBackground(const QString &iBackground)
{
mBackground = iBackground;
}
void StackedWidget::paintEvent(QPaintEvent *iEvent)
{
Q_UNUSED(iEvent)
if (!mBackground.isEmpty()) {
QPainter p(this);
p.drawPixmap(this->rect(), QPixmap(mBackground));
}
}
#ifndef SYSMAINWINDOW_H
#define SYSMAINWINDOW_H
#include <QStackedWidget>
#include <topcore/topclassabs.h>
#include <QSystemTrayIcon>
class QHBoxLayout;
class QLabel;
class QPropertyAnimation;
class QStackedWidget;
class QTabBar;
class QDateTime;
class QVBoxLayout;
class TFramelessWindowBar;
class TPanelMenu;
class TopMessageController;
class TopQuickToolBar;
class TopQuickButton;
class TToolButton;
class QSplitter;
struct NaviData;
class StretchFrame: public QFrame {
Q_OBJECT
public:
StretchFrame(QWidget* iParent = nullptr);
void setWidget(QWidget *iWidget);
void setStretchWidgetVisible(bool iVisible);
protected:
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *);
bool event(QEvent *event);
void showEvent(QShowEvent *event);
private:
bool mLeftButtonPressed = false;
QPoint mDragPosition;
qreal mStretchWidgetWidth = 1;
bool mMouseAnchor = false;
QWidget *mWidget = nullptr;
QFrame *mStretchWidget = nullptr;
QHBoxLayout *mLayout = nullptr;
};
class StackedWidget : public QStackedWidget {
Q_OBJECT
public:
StackedWidget(QWidget *iParent = nullptr);
void setBackground(const QString &iBackground);
protected:
void paintEvent(QPaintEvent *iEvent);
private:
QString mBackground;
};
class SysMainWindow final : public TopClassAbs
{
Q_OBJECT
public:
enum class RouteType {
None,
Module,
Menu,
Action,
Url,
ModuleBar
};
public:
explicit SysMainWindow(const QString &iModuleNameStr = QString(""),
const QVariantMap &iUrlPars = QVariantMap(),
QWidget *iParent = nullptr);
~SysMainWindow();
public slots:
void openModule(const QString &iUrl, const QVariant &iConfig = QVariant());
void showPasswordModificationDialog();
void showAboutDialog();
void openModuleUpgrade();
void setIsPinned(bool iIsPinned, bool iForce = false);
bool hide2SystemTrayState();
void saveHide2SystemTrayState(bool iState);
bool isSystemTrayIconShow();
protected:
bool nativeEvent(const QByteArray &iEventTypeLst,
void *iMsgPtr,
long *oResultI64Ptr) override;
void closeEvent(QCloseEvent *iEvent) override;
private slots:
void onOperateTimer();
void onQuickBtnClicked();
void onTabBarCurrentChanged(int iIndexInt);
void onTabBarCloseRequested(int iIndexInt);
void onNaviButtonClicked();
void onPinButtonClicked();
void onPanelMenuClicked(const QVariant &iDataVar);
void onNotification(const QString &iKeyStr, const QVariant &iDataVar, const QString &iUuid);
void onModuleWindowTitleChanged();
void onSysTrayIconActived(QSystemTrayIcon::ActivationReason reason);
private:
void initIsPinned();
void initNaviToolBar();
void initMainWidget();
void initDefaultRoute();
void updateTabBar(const QString &iUrl, const QVariant &iConfigVar = QVariant());
void updateTabBarWhenRemoveTab(int iIndexInt);
void updatePopupWidget(TopQuickButton *iBtn, const QVariantMap &iConfigVar, RouteType type);
void movePanelMenuWidget();
void initSysTrayIcon();
RouteType str2RouteType(const QString &iTypeStr);
void routeUrl(const QString &iUrlAddressStr, const QVariantMap &iConfigVar);
void routeModule(const QString &iUrlAddressStr, const QVariantMap &iConfigVar);
void routeAction(const QString &iUrlAddressStr);
void route(TopQuickButton *iBtn, NaviData *iData, const QVariantMap &iConfigVar);
void insertStatusInfo(QVariantList &oMenuDataLst);
void insertStatusInfo(QVariantList &oMenuDataLst, const QVariantMap &iModulePermission, const QVariantMap &iActionPermission);
QVariantMap getUrlAddressInfo(const QVariantList &iMenuDataLst);
void buildPanelMenuData(QVariantList &oMenuDataLst);
QVariantMap searchDefaultRoute(const QVariantList &iNaviLst);
void showCloseDialog();
private:
QDateTime *mPreOperateTime = nullptr;
QPointF mPreMousePos;
QPointF mNowMousePos;
bool mPreWindowHideState = false;
bool mNowWindowHideState = false;
bool mPreWindowActiveState = false;
bool mNowWindowActiveState = false;
QTimer *mOperateTimeOutTimer = nullptr;
TopQuickToolBar *mNaviToolBar = nullptr;
TFramelessWindowBar *mWindowTitleBar = nullptr;
QTabBar *mTabBar = nullptr;
StackedWidget *mStackedWidget = nullptr;
QStackedWidget *mModuleBarStackedWidget = nullptr;
QMap<QString, TopClassAbs *> mModuleBarUrlAddressMap;
QMap<TopQuickButton *, NaviData *> mNaviDataMap;
TopQuickButton *mCurrentActiveQuickBtn = nullptr;
QLabel *mPanelMenuTitleLabel = nullptr;
TToolButton *mPinButton = nullptr;
TPanelMenu *mPanelMenu = nullptr;
StretchFrame *mPopupWidget = nullptr;
QSplitter *mCenterWidget = nullptr;
QWidget *mMainWidget = nullptr;
QHBoxLayout *mMainLayout = nullptr;
QMap<QString, QWidget *> mUrlAddressWidgetMap; // urlAddress:QWidget
QMap<QString, QVariantMap> mUrlAddressConfigMap; // urlAddress:Config
bool mIsPinned = false;
QLabel *mMessageLabel = nullptr;
QPropertyAnimation *mMessageAnimation = nullptr;
TopMessageController *mMessageController = nullptr;
bool mIsRoutingModule = false;
// 托盘图标
QSystemTrayIcon *mSysTrayIcon = nullptr;
bool mSysTrayIconShow = false; // 是否显示托盘图标
bool mHidetoSysTray = false; // 关闭时是否隐藏程序到托盘
bool mHidetoSysTrayFlag = false; // 注册表中是否有mHidetoSysTray标记,是否显示确认弹窗
QString mHidetoTrayRegName;
QString mSysTrayTitle;
};
#endif // SYSMAINWINDOW_H
#include "SysMainWindow.h"
#include <QCloseEvent>
#include <QDesktopServices>
#include <QProcess>
#include <QGraphicsDropShadowEffect>
#include <QHBoxLayout>
#include <QMenu>
#include <QDateTime>
#include <QResource>
#include <QTabBar>
#include <QFileDialog>
#include <QFileInfo>
#include <QToolBar>
#include <QApplication>
#include <QVBoxLayout>
#include <QPainter>
#include <tbaseutil/tdataparse.h>
#include <tbaseutil/tfileio.h>
#include <tbaseutil/tlogger.h>
#include <tbaseutil/tresource.h>
#include <tbaseutil/ttheme.h>
#include <tdatabaseutil/tsqlqueryv2.h>
#include <tdatabaseutil/tsqlconnectionpoolv2.h>
#include <toputil/topaboutusdialog.h>
#include <topcore/topclasssqlthread.h>
#include <topcore/topcore.h>
#include <toputil/toploginpwdrestdialog.h>
#include <topcore/topmessagecontroller.h>
#include <twidget/tmessagebox.h>
#include <twidget/tpushbutton.h>
#include <twidget/tuiloaderdialog.h>
#include <twidget/tpanelmenu.h>
#include <twidget/twebview.h>
#include <twidget/ttoolbutton.h>
#include <twidget/tdialog.h>
#include <twidget/tradiobox.h>
#include <twidget/tcheckbox.h>
#include <twidget/tgroupbox.h>
#include <twidget/tdialogbuttonbox.h>
SysMainWindow::SysMainWindow(const QString &iModuleNameStr,
const QVariantMap &iUrlPars,
QWidget *iParent)
:TopClassAbs(iParent)
{
initModule(iModuleNameStr,iUrlPars);
if (this->isHookExists("afterModuleInit")) {
this->callHooks("afterModuleInit");
}
setHasWindowTitleBar(false);
QStringList rccLst = config("resource.rcc").toStringList();
for (QString rcc : rccLst) {
TRES->loadRcc(rcc);
}
initMainWidget();
setMinimumSize(TTHEME_DP(800), TTHEME_DP(600));
QVariantMap defalutSize = config("default_size").toMap();
if (!defalutSize.isEmpty() && defalutSize["width"].toInt() > 0
&& defalutSize["height"].toInt() > 0) {
resize(TTHEME_DP(defalutSize["width"].toInt()),
TTHEME_DP(defalutSize["height"].toInt()));
} else {
showMaximized();
}
refreshActionState();
}
SysMainWindow::~SysMainWindow()
{
if (this->isHookExists("onDestory")) {
this->callHooks("onDestory");
}
}
//初始化主界面
void SysMainWindow::initMainWidget()
{
mBodySplitter = new QSplitter(this);
mBodySplitter->setObjectName("mBodySplitter");
setCentralWidget(mBodySplitter);
mMgtSplitter = new QSplitter(this);
mBodySplitter->addWidget(mMgtSplitter);
mBodyWgt = new QWidget(this);
QVBoxLayout *bodyLayout = new QVBoxLayout(mBodyWgt);
bodyLayout->setMargin(0);
bodyLayout->setSpacing(0);
mMgtSplitter->addWidget(mBodyWgt);
}
//打开当前选择模块
void SysMainWindow::openModule(const QString &iUrl,
const QVariant &iConfig)
{
bool exists = false;
TopClassAbs *module = APP->openModule(iUrl, &exists);
if (module == nullptr) {
TLOG_ERROR(QString("open module(%1) failed!").arg(iUrl));
return;
}
QVariantMap paramMap = iConfig.toMap();
QString title = paramMap.value("title_" + APP->language()).toString();
if (title.isEmpty()) {
title = paramMap.value("title").toString();
}
module->setTitle(title);
module->setIconName(paramMap.value("icon").toString());
const QString url = module->url().toUpper();
if (!exists) {
connect(module, SIGNAL(windowTitleChanged(QString)),
this, SLOT(onModuleWindowTitleChanged()),
Qt::UniqueConnection);
connect(module, SIGNAL(windowModifyChanged(bool)),
this, SLOT(onModuleWindowTitleChanged()),
Qt::UniqueConnection);
}
if (!mUrlAddressWidgetMap.contains(url)) {
mUrlAddressWidgetMap.insert(url, module);
mUrlAddressConfigMap.insert(url, iConfig.toMap());
}
QVariantMap config;
config.insert("title", module->title());
config.insert("icon", module->iconName());
mStackedWidget->addWidget(module);
mStackedWidget->setCurrentWidget(module);
}
void StackedWidget::setBackground(const QString &iBackground)
{
mBackground = iBackground;
}
void StackedWidget::paintEvent(QPaintEvent *iEvent)
{
Q_UNUSED(iEvent)
if (!mBackground.isEmpty()) {
QPainter p(this);
p.drawPixmap(this->rect(), QPixmap(mBackground));
}
}
#ifndef MWINDOWS_H
#define MWINDOWS_H
#include <QStackedWidget>
#include <topcore/topclassabs.h>
#include <topcore/topclasshelper.h>
#include <tdatabaseutil/tsqlselectorv2.h>
#include <QSystemTrayIcon>
#include <QLineEdit>
#include <QSplitter>
#include <QPushButton>
class QHBoxLayout;
class QLabel;
class QPropertyAnimation;
class QStackedWidget;
class QTabBar;
class QDateTime;
class QVBoxLayout;
class TFramelessWindowBar;
class TPanelMenu;
class TopMessageController;
class TopQuickToolBar;
class TopQuickButton;
class TToolButton;
class TSplitter;
class StackedWidget : public QStackedWidget {
Q_OBJECT
public:
StackedWidget(QWidget *iParent = nullptr);
void setBackground(const QString &iBackground);
protected:
void paintEvent(QPaintEvent *iEvent);
private:
QString mBackground;
};
class SysMainWindow:public TopClassAbs
{
Q_OBJECT
public:
explicit SysMainWindow(const QString &iModuleNameStr = QString(""),
const QVariantMap &iUrlPars = QVariantMap(),
QWidget *iParent = nullptr);
~SysMainWindow();
public slots:
void openModule(const QString &iUrl, const QVariant &iConfig);
private:
QMap<QString, QWidget *> mUrlAddressWidgetMap; // urlAddress:QWidget
QMap<QString, QVariantMap> mUrlAddressConfigMap;
QHBoxLayout *Hboxlayout;
QLineEdit Title;
QLabel *mMessageLabel = nullptr;
StackedWidget *mStackedWidget = nullptr;
QSplitter *mBodySplitter = nullptr;
QSplitter *mMgtSplitter = nullptr;
QWidget *mBodyWgt;
void initMainWidget();
};
#endif
HEADERS += \
##$$PWD/sysmainwindow.h \
$$PWD/msysmainwindow.h \
$$PWD/topquickbutton.h \
$$PWD/topquicktoolbar.h
SOURCES += \
##$$PWD/sysmainwindow.cpp \
$$PWD/msysmainwindow.cpp \
$$PWD/topquickbutton.cpp \
$$PWD/topquicktoolbar.cpp
#include "topquickbutton.h"
#include <QLayout>
#include <QMenu>
#include <QPainter>
#include <QPaintEvent>
#include <QVariant>
#include <tbaseutil/tresource.h>
#include <tbaseutil/ttheme.h>
#include <topcore/topclassabs.h>
class TopQuickButtonPrivate
{
Q_DECLARE_PUBLIC(TopQuickButton)
public:
explicit TopQuickButtonPrivate(TopQuickButton *qptr)
: q_ptr(qptr)
{
}
~TopQuickButtonPrivate()
{
}
QString uidStr;
bool modifiedBol = false;
bool closableBol = false;
bool activedBol = false;
bool openedBol = false;
QVariant dataVar;
protected:
TopQuickButton * const q_ptr;
};
TopQuickButton::TopQuickButton(QWidget *parent) :
QToolButton(parent),
d_ptr(new TopQuickButtonPrivate(this))
{
setStyleSheet(QString("TopQuickButton{margin:%1px; border:none; background:#2196F3; border-radius:%2px;color:#FFFFFF;}\n" \
"TopQuickButton:hover{border-radius:%3px}\n" \
"QToolButton::menu-indicator{image:None;}")
.arg(TTHEME_DP(4)).arg(TTHEME_DP(10)).arg(TTHEME_DP(16)));
setFixedSize(QSize(TTHEME_DP(40),TTHEME_DP(40)));
}
TopQuickButton::~TopQuickButton()
{
}
void TopQuickButton::setUid(const QString &iUidStr)
{
Q_D(TopQuickButton);
d->uidStr = iUidStr;
}
QString TopQuickButton::uid() const
{
Q_D(const TopQuickButton);
return d->uidStr;
}
void TopQuickButton::setData(const QVariant &iDataVar)
{
Q_D(TopQuickButton);
d->dataVar = iDataVar;
}
QVariant TopQuickButton::data() const
{
Q_D(const TopQuickButton);
return d->dataVar;
}
void TopQuickButton::setModified(bool iBol)
{
Q_D(TopQuickButton);
if (d->modifiedBol != iBol) {
d->modifiedBol = iBol;
changeStyleSheet();
}
}
bool TopQuickButton::isModified() const
{
Q_D(const TopQuickButton);
return d->modifiedBol;
}
void TopQuickButton::setClosable(bool iBol)
{
Q_D(TopQuickButton);
d->closableBol = iBol;
}
bool TopQuickButton::isClosable() const
{
Q_D(const TopQuickButton);
return d->closableBol;
}
void TopQuickButton::setActived(bool iBol)
{
Q_D(TopQuickButton);
if (d->activedBol != iBol) {
d->activedBol = iBol;
changeStyleSheet();
}
}
bool TopQuickButton::isActived() const
{
Q_D(const TopQuickButton);
return d->activedBol;
}
void TopQuickButton::setOpened(bool iBol)
{
Q_D(TopQuickButton);
if (d->openedBol != iBol) {
d->openedBol = iBol;
changeStyleSheet();
}
}
bool TopQuickButton::isOpened() const
{
Q_D(const TopQuickButton);
return d->openedBol;
}
void TopQuickButton::changeStyleSheet()
{
}
#ifndef TOPQUICKBUTTON_H
#define TOPQUICKBUTTON_H
#include <QToolButton>
#include <QVariant>
#include <QWidget>
class TopClassAbs;
class TopQuickButtonPrivate;
class TopQuickButton : public QToolButton
{
Q_OBJECT
public:
explicit TopQuickButton(QWidget *parent = nullptr);
~TopQuickButton();
public slots:
void setUid(const QString &iUidStr);
QString uid() const;
void setData(const QVariant &iDataVar);
QVariant data() const;
void setModified(bool iBol);
bool isModified() const;
void setClosable(bool iBol);
bool isClosable() const;
void setActived(bool iBol);
bool isActived() const;
void setOpened(bool iBol);
bool isOpened() const;
private slots:
void changeStyleSheet();
protected:
const QScopedPointer<TopQuickButtonPrivate> d_ptr;
private:
Q_DISABLE_COPY(TopQuickButton)
Q_DECLARE_PRIVATE(TopQuickButton)
};
#endif // TOPQUICKBUTTON_H
#include "topquicktoolbar.h"
#include <QActionGroup>
#include <QMenu>
#include <QStackedWidget>
#include <QVariantMap>
#include <tbaseutil/tdataparse.h>
#include <tbaseutil/tresource.h>
#include <tbaseutil/ttheme.h>
#include <topcore/topcore.h>
#include "topquickbutton.h"
class TopQuickToolBarPrivate
{
Q_DECLARE_PUBLIC(TopQuickToolBar)
public:
explicit TopQuickToolBarPrivate(TopQuickToolBar *qptr)
: languageStr(APP->language()),
q_ptr(qptr)
{
}
~TopQuickToolBarPrivate()
{
}
QString languageStr;
QActionGroup *mToolBarActions;
protected:
TopQuickToolBar * const q_ptr;
};
TopQuickToolBar::TopQuickToolBar(QWidget *parent)
: QToolBar(parent),
d_ptr(new TopQuickToolBarPrivate(this))
{
Q_D(TopQuickToolBar);
d->mToolBarActions = new QActionGroup(this);
// this->setIconSize(QSize(16, 16));
}
TopQuickToolBar::~TopQuickToolBar()
{
// 保存来自用户配置的数据
QEventLoop loop;
connect(this, SIGNAL(userDataSaved()), &loop, SLOT(quit()));
QTimer::singleShot(300, &loop, SLOT(quit()));
emit saveUserData();
loop.exec();
}
void TopQuickToolBar::setLanguage(const QString &iLangStr)
{
Q_D(TopQuickToolBar);
d->languageStr = iLangStr;
}
QString TopQuickToolBar::language() const
{
Q_D(const TopQuickToolBar);
return d->languageStr;
}
void TopQuickToolBar::loadQuickButtons(const QVariantList &iVarLst)
{
for (QVariant var: iVarLst) {
addQuickButton(var.toMap());
}
}
TopQuickButton *TopQuickToolBar::addQuickButton(const QVariantMap &iParamMap)
{
Q_D(TopQuickToolBar);
TopQuickButton *btn = createQuickBtn(iParamMap);
btn->setToolButtonStyle(Qt::ToolButtonIconOnly);
d->mToolBarActions->addAction(addWidget(btn));
return btn;
}
void TopQuickToolBar::clearAllButtons()
{
Q_D(TopQuickToolBar);
// 清除当前ACTION,会自动析构对应的QToolButoon
QList<QAction *> listAction = d->mToolBarActions->actions();
for (QAction *act: listAction) {
d->mToolBarActions->removeAction(act);
this->removeAction(act);
act->deleteLater();
}
}
TopQuickButton *TopQuickToolBar::createQuickBtn(const QVariantMap &iParamMap)
{
Q_D(TopQuickToolBar);
TopQuickButton *toolBtn = new TopQuickButton(this);
QString btnTextStr = iParamMap.value("title_" + d->languageStr).toString();
if (btnTextStr.isEmpty()) {
btnTextStr = iParamMap.value("title").toString();
}
QString btnTooltipStr = iParamMap.value("remark_" + d->languageStr).toString();
if (btnTooltipStr.isEmpty()) {
btnTooltipStr = iParamMap.value("remark").toString();
}
if (btnTooltipStr.isEmpty()) {
btnTooltipStr = btnTextStr;
}
QString iconStr = iParamMap.value("icon").toString();
if (!iconStr.isEmpty() && !iconStr.contains('.')) {
iconStr += ".white";
}
toolBtn->setText(btnTextStr);
toolBtn->setToolTip(btnTooltipStr);
if (!iconStr.isEmpty()) {
toolBtn->setIcon(TRES->colorIcon(iconStr));
}
QString bgColor;
if (iParamMap.contains("icon_bgcolor") &&
!iParamMap.value("icon_bgcolor").toString().isEmpty()) {
bgColor = iParamMap.value("icon_bgcolor").toString();
} else {
bgColor = TTHEME->value("COLOR_PRIMARY_5").toString();
}
toolBtn->setStyleSheet(QString("TopQuickButton{border:none; background:%1;margin:%2px; border-radius:%3px;color:#FFFFFF;}\n" \
"TopQuickButton:hover{border-radius:%4px}\n" \
"QToolButton::menu-indicator{image:None;}")
.arg(bgColor).arg(TTHEME_DP(4)).arg(TTHEME_DP(10)).arg(TTHEME_DP(16)));
toolBtn->setData(iParamMap);
return toolBtn;
}
#ifndef TOPQUICKTOOLBAR_H
#define TOPQUICKTOOLBAR_H
#include <QToolBar>
#include <QVariant>
#include <QVariantList>
class QMenu;
class QStackedWidget;
class TopQuickButton;
class TopQuickToolBarPrivate;
class TopQuickToolBar : public QToolBar
{
Q_OBJECT
public:
explicit TopQuickToolBar(QWidget *parent = nullptr);
~TopQuickToolBar();
signals:
void saveUserData();
void userDataSaved();
void sizeChanged(QSize);
public slots:
void setLanguage(const QString &iLangStr);
QString language() const;
void loadQuickButtons(const QVariantList &iVarLst);
TopQuickButton *addQuickButton(const QVariantMap &iParamMap);
void clearAllButtons();
private:
TopQuickButton *createQuickBtn(const QVariantMap &iParamMap);
protected:
const QScopedPointer<TopQuickToolBarPrivate> d_ptr;
private:
Q_DISABLE_COPY(TopQuickToolBar)
Q_DECLARE_PRIVATE(TopQuickToolBar)
};
#endif // TOPQUICKTOOLBAR_H
#include "musermgt.h" #include "sysusermgt.h"
#include <QGraphicsDropShadowEffect> #include <QGraphicsDropShadowEffect>
#include <QToolBar> #include <QToolBar>
#include <QVBoxLayout> #include <QVBoxLayout>
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <twidget/tscrollarea.h> #include <twidget/tscrollarea.h>
#include <twidget/ttabwidget.h> #include <twidget/ttabwidget.h>
#include <tbaseutil/tresource.h> #include <tbaseutil/tresource.h>
#include <tbaseutil/tdataparse.h>
Musermgt::Musermgt(const QString &iModuleNameStr, Musermgt::Musermgt(const QString &iModuleNameStr,
...@@ -48,8 +49,8 @@ Musermgt::Musermgt(const QString &iModuleNameStr, ...@@ -48,8 +49,8 @@ Musermgt::Musermgt(const QString &iModuleNameStr,
} }
TopClassHelper::parseTableConf0(this, "view", &mTableConf); TopClassHelper::parseTableConf0(this, "view", &mTableConf);
initTableView(); initTableView();
connect(this, SIGNAL(detailSaved(QString)), connect(this, SIGNAL(detailSaved(QVariant)),
this, SLOT(onDetailSaved(QString))); this, SLOT(onDetailSaved(QVariant)));
connect(this, SIGNAL(isDetailModifiedChanged(bool)), connect(this, SIGNAL(isDetailModifiedChanged(bool)),
this, SLOT(onDetailChanged(bool))); this, SLOT(onDetailChanged(bool)));
connect(this, SIGNAL(detailUidChanged(QString)), connect(this, SIGNAL(detailUidChanged(QString)),
...@@ -63,15 +64,6 @@ Musermgt::Musermgt(const QString &iModuleNameStr, ...@@ -63,15 +64,6 @@ Musermgt::Musermgt(const QString &iModuleNameStr,
refreshActionState(); refreshActionState();
QTimer::singleShot(0, this, SLOT(refresh())); QTimer::singleShot(0, this, SLOT(refresh()));
auto refreshInterval = config("view.timing_refresh_interval", 0).toInt();
if (refreshInterval > 0) {
mRefreshTimer = new QTimer(this);
connect(mRefreshTimer, &QTimer::timeout, [=]() {
this->callAction("refresh");
});
mRefreshTimer->start(refreshInterval * 1000);
}
} }
Musermgt::~Musermgt() Musermgt::~Musermgt()
...@@ -80,6 +72,16 @@ Musermgt::~Musermgt() ...@@ -80,6 +72,16 @@ Musermgt::~Musermgt()
this->saveObjectState(mTableView); this->saveObjectState(mTableView);
} }
void Musermgt::setData(const QVariantMap &iDataMap)
{
DetailView->loadValues(iDataMap, false);
if (iDataMap.contains("username")) {
setTitle(ttr("User-%1").arg(iDataMap.value("username").toString()));
}
}
void Musermgt::reload() void Musermgt::reload()
{ {
setDetailUid(mLastDetailUid.isEmpty() ? mDetailUid : mLastDetailUid, true); setDetailUid(mLastDetailUid.isEmpty() ? mDetailUid : mLastDetailUid, true);
...@@ -93,7 +95,6 @@ bool Musermgt::DetailModified() const ...@@ -93,7 +95,6 @@ bool Musermgt::DetailModified() const
void Musermgt::setIsDetailModified(bool iIsDetailModified) void Musermgt::setIsDetailModified(bool iIsDetailModified)
{ {
if (IsDetailchange == iIsDetailModified) { if (IsDetailchange == iIsDetailModified) {
qDebug()<<iIsDetailModified;
return; return;
} }
IsDetailchange = iIsDetailModified; IsDetailchange = iIsDetailModified;
...@@ -126,7 +127,7 @@ void Musermgt::newItem() ...@@ -126,7 +127,7 @@ void Musermgt::newItem()
} }
//新增用户 //新增用户
void Musermgt::addUser() void Musermgt::saveItem()
{ {
//验证有效性 //验证有效性
QVariantList errLst = DetailView->validateAll("COMMIT", true, "ERROR"); QVariantList errLst = DetailView->validateAll("COMMIT", true, "ERROR");
...@@ -157,8 +158,14 @@ void Musermgt::addUser() ...@@ -157,8 +158,14 @@ void Musermgt::addUser()
saveData.insert(i.key(), i.value()); //向saveData里插入各项数据的键和值 saveData.insert(i.key(), i.value()); //向saveData里插入各项数据的键和值
} }
} }
insertor.setData(saveData); QVariantMap defaultValueMap;
QStringList fields = saveData.keys(); QVariantMap resultmap;
defaultValueMap = defaultValueMap.unite(config("default_value").toMap());
QString password = defaultValueMap.value("password").toString();
resultmap = TDataParse::mergeVariantMap(saveData, defaultValueMap);
resultmap.insert("password", TDataParse::getVariantMd5(password));
insertor.setData(resultmap);
QStringList fields = resultmap.keys();
fields.removeOne(mTableConf.primaryKey); fields.removeOne(mTableConf.primaryKey);
insertor.setField(fields); insertor.setField(fields);
{ {
...@@ -176,7 +183,7 @@ void Musermgt::addUser() ...@@ -176,7 +183,7 @@ void Musermgt::addUser()
alertError(ttr("Save data failed!"), err.text()); alertError(ttr("Save data failed!"), err.text());
return; return;
} }
emit detailSaved(result.toString()); emit detailSaved(result);
setIsDetailModified(false); setIsDetailModified(false);
alertOk(ttr("Data saved")); alertOk(ttr("Data saved"));
} }
...@@ -267,6 +274,9 @@ void Musermgt::refresh(bool iResetPage) ...@@ -267,6 +274,9 @@ void Musermgt::refresh(bool iResetPage)
selector.setTable(QString("(1% TEMP_TABLE)").arg(mTableConf.dbSql)); selector.setTable(QString("(1% TEMP_TABLE)").arg(mTableConf.dbSql));
} else if (!mTableConf.dbTableName.isEmpty()) { } else if (!mTableConf.dbTableName.isEmpty()) {
selector.setTable(mTableConf.dbTableName); selector.setTable(mTableConf.dbTableName);
} else {
alertError(ttr("dbSql or dbtablename isempty!"));
return; //dbSql和dbTableName为空则返回不做处理
} }
selector.setField(mTableConf.queryFields); selector.setField(mTableConf.queryFields);
selector.setFieldFormat(mTableConf.fieldFormatMap); selector.setFieldFormat(mTableConf.fieldFormatMap);
...@@ -350,7 +360,6 @@ void Musermgt::initTableView() ...@@ -350,7 +360,6 @@ void Musermgt::initTableView()
bodyLayout->setMargin(0); bodyLayout->setMargin(0);
bodyLayout->setSpacing(0); bodyLayout->setSpacing(0);
mBodyWidget->addWidget(mBodyWgt); mBodyWidget->addWidget(mBodyWgt);
initNavi();
mTableView = new TTableView(this); mTableView = new TTableView(this);
mTableView->setObjectName("__view__"); mTableView->setObjectName("__view__");
...@@ -549,171 +558,3 @@ void Musermgt::initAdvanceCfgMap() ...@@ -549,171 +558,3 @@ void Musermgt::initAdvanceCfgMap()
} }
mAdvancedQueryCfgMap.insert("advanced_items", newQueryItems); mAdvancedQueryCfgMap.insert("advanced_items", newQueryItems);
} }
void Musermgt::initNavi()
{
mNaviType = str2NaviType(config("navi.__type__", "CategoryTreeView").toString());
if (mNaviType == NaviType::None) {
return;
}
TAccordion *accordion = new TAccordion(this);
accordion->setObjectName("__navi__");
accordion->setProperty("SS_BG","NAVI");
accordion->setMinimumWidth(TTHEME_DP(config("navi.min_width", 150).toInt()));
accordion->setMaximumWidth(TTHEME_DP(config("navi.max_width", 300).toInt()));
accordion->setAccordionLocation(TAccordion::AccordionLocation::Left);
QVBoxLayout *naviLayout = new QVBoxLayout(accordion);
naviLayout->setMargin(0);
naviLayout->setSpacing(0);
QLabel *naviLabel = new QLabel(tr("Navigation"));
naviLabel->setProperty("SS_TYPE", "SUBHEADER");
naviLayout->addWidget(naviLabel,0);
naviLayout->addSpacing(TTHEME_DP(4));
accordion->expandButton()->setFixedHeight(TTHEME_DP(40));
accordion->expandButton()->setToolTip(tr("Show Navigation"));
accordion->collapseButton()->setToolTip(tr("Hide Navigation"));
accordion->setIsExpanded(config("navi.is_expanded", false).toBool());
mBodyWidget->insertWidget(0,accordion);
if (mNaviType == NaviType::UiLoader) {
mNaviView = new TUiLoader(this);
TUiLoader *filterUi = qobject_cast<TUiLoader*>(mNaviView);
filterUi->setSelf(this);
filterUi->setScriptEngine(APP->scriptEngine());
filterUi->setUiStr(ui("navi").toString());
QFrame *naviWgt = new QFrame(this);
QVBoxLayout *leftLayout = new QVBoxLayout(naviWgt);
leftLayout->addWidget(mNaviView);
QHBoxLayout *leftBtnsLayout = new QHBoxLayout();
leftLayout->addLayout(leftBtnsLayout);
QPushButton *resetBtn = new QPushButton(this);
connect(resetBtn, SIGNAL(clicked(bool)), filterUi, SLOT(clearValues()));
leftBtnsLayout->addWidget(resetBtn);
resetBtn->setText(tr("Reset"));
resetBtn->setIcon(TRES->icon("rotate-right"));
QPushButton *filterBtn = new QPushButton(this);
connect(filterBtn, SIGNAL(clicked(bool)), this, SLOT(refresh()));
leftBtnsLayout->addWidget(filterBtn);
filterBtn->setText(tr("Filter"));
filterBtn->setIcon(TRES->icon("filter"));
leftLayout->addStretch(1);
naviLayout->addWidget(naviWgt);
} else if (mNaviType == NaviType::AdvancedQuery) {
Q_ASSERT_X(false, "TopTemplateClass4", "This feature is not yet supported.");
} else if (mNaviType == NaviType::NaviFilter) {
Q_ASSERT_X(false, "TopTemplateClass4", "This feature is not yet supported.");
} else if (mNaviType == NaviType::CategoryTreeViewAndAdvancedQuery) {
// tab1-CategoryTreeView
TCategoryTreeView *categoryTreeView = new TCategoryTreeView(this);
categoryTreeView->setStyleSheet("TCategoryTreeView{border:NONE;background-color:transparent}");
QVariantList rootChildList = parseCategoryConfig();
if (rootChildList.isEmpty()) {
mNaviView->setVisible(false);
return;
}
categoryTreeView->setItemList(rootChildList);
categoryTreeView->setCheckable(config("navi.is_checkable").toBool());
connect(categoryTreeView, SIGNAL(selectionChanged(QVariantList)),
this, SLOT(onCategoryViewDataChanged(QVariantList)));
// tab2-tab1-ToolBar
QToolBar *toolbar = new QToolBar(this);
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
toolbar->setProperty("SS_SIZE", "SMALL");
toolbar->setMovable(false);
QAction *queryAction = toolbar->addAction(APP->getResIcon("search"), tr("Query"));
connect(queryAction, SIGNAL(triggered()), this, SLOT(refresh()));
toolbar->addSeparator();
QAction* addAction = toolbar->addAction(APP->getResIcon("addto-circle-o"), tr("Add"));
addAction->setToolTip(tr("Add query criteria"));
//connect(addAction, SIGNAL(triggered()), this, SLOT(onAddActionTriggered()));
QAction* clearAction = toolbar->addAction(APP->getResIcon("eraser"), tr("Clear"));
clearAction->setToolTip(tr("Clear all query criteria"));
//connect(clearAction, SIGNAL(triggered()), this, SLOT(onClearActionTriggered()));
QAction* saveAsAction = toolbar->addAction(APP->getResIcon("save"), tr("Save As"));
saveAsAction->setToolTip(tr("Save query criteria as file"));
//connect(saveAsAction, SIGNAL(triggered()), this, SLOT(onSaveAsActionTriggered()));
QAction* openActtion = toolbar->addAction(APP->getResIcon("folder-open-o"), tr("Open"));
openActtion->setToolTip(tr("Open query criteria from file"));
//connect(openActtion, SIGNAL(triggered()), this, SLOT(onOpenActtionTriggered()));
QAction* saveAsCommonQueryAction = toolbar->addAction(APP->getResIcon("save-as"), tr("Save"));
saveAsCommonQueryAction->setToolTip(tr("Save as a common query"));
//connect(saveAsCommonQueryAction, SIGNAL(triggered()), this, SLOT(onSaveAsCommonQueryActionTriggered()));
// tab2-tab1-AdvancedQuery
TAdvancedQuery *advancedQuery = new TAdvancedQuery(this);
advancedQuery->setObjectName("AdvancedQuery");
initAdvanceCfgMap();
advancedQuery->setItemList(mAdvancedQueryCfgMap.value("advanced_items").toList());
advancedQuery->setData(getDefaultQueryDataFromCfgMap());
TScrollArea *scrollArea = new TScrollArea(this);
scrollArea->setWidgetResizable(true);
scrollArea->setWidget(advancedQuery);
// tab2-tab1
QMainWindow *mainWindow = new QMainWindow(this);
mainWindow->addToolBar(toolbar);
mainWindow->setCentralWidget(scrollArea);
// tab2-tab2-TableView
TTableView *commonQueryTable = new TTableView(this);
commonQueryTable->setObjectName("CommonQueryTable");
commonQueryTable->setShowGrid(false);
commonQueryTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
commonQueryTable->verticalHeader()->setVisible(false);
QVariantList headerItem;
headerItem << QVariant() << TDataParse::variantList2Map(
QVariantList() <<"name" << "title" << "display" << tr("Query Name") << "resizeMode" << "Stretch" << "displayRole" << "$title");
commonQueryTable->setHeaderItem(headerItem);
commonQueryTable->setDataKeyList(QStringList() << "title" << "condition");
commonQueryTable->setPrimaryKey("condition");
//connect(commonQueryTable, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(onCommonQueryTableDoubleClicked(const QModelIndex &)));
QAction *deleleCommonQueryActtion = new QAction(APP->getResIcon("remove"), tr("Delete query"), this);
connect(deleleCommonQueryActtion, SIGNAL(triggered()), this, SLOT(onDeleleCommonQueryActtionTriggered()));
QMenu *contextMenu = new QMenu(this);
contextMenu->addAction(deleleCommonQueryActtion);
commonQueryTable->setContextMenu(contextMenu);
// 刷新常用查询表格数据
//initCommonQueryMap();
//commonQueryTable->loadData(mAdvancedQueryTableDataMap.value("advance").toList());
// 高级查询Tab
TTabWidget *advancedQueryTabWidget = new TTabWidget(this);
advancedQueryTabWidget->setObjectName("AdvancedQueryTabWidget");
advancedQueryTabWidget->addTab(mainWindow, tr("Advanced Query"));
advancedQueryTabWidget->addTab(commonQueryTable, tr("Common Query"));
// 导航Tab
mNaviView = new TTabWidget(this);
TTabWidget *tabWidget = qobject_cast<TTabWidget *>(mNaviView);
tabWidget->addTab(categoryTreeView, tr("Category"));
tabWidget->addTab(advancedQueryTabWidget, tr("Advanced Query"));
naviLayout->addWidget(mNaviView);
} else {
mNaviView = new TCategoryTreeView(this);
mNaviView->setStyleSheet("TCategoryTreeView{border:NONE;background-color:transparent}");
QVariantList rootChildList = parseCategoryConfig();
if (rootChildList.isEmpty()) {
mNaviView->setVisible(false);
return;
}
TCategoryTreeView *categoryTreeView = qobject_cast<TCategoryTreeView *>(mNaviView);
categoryTreeView->setItemList(rootChildList);
categoryTreeView->setCheckable(config("navi.is_checkable").toBool());
connect(categoryTreeView, SIGNAL(selectionChanged(QVariantList)),
this, SLOT(onCategoryViewDataChanged(QVariantList)));
naviLayout->addWidget(mNaviView);
}
}
...@@ -15,9 +15,7 @@ class TSplitter; ...@@ -15,9 +15,7 @@ class TSplitter;
class Musermgt : public TopClassAbs class Musermgt : public TopClassAbs
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Musermgt(const QString &iModuleNameStr = QString(""), explicit Musermgt(const QString &iModuleNameStr = QString(""),
const QVariantMap &iUrlPars = QVariantMap(), const QVariantMap &iUrlPars = QVariantMap(),
QWidget *iParent = nullptr); QWidget *iParent = nullptr);
...@@ -29,22 +27,20 @@ public: ...@@ -29,22 +27,20 @@ public:
NaviFilter, NaviFilter,
CategoryTreeViewAndAdvancedQuery CategoryTreeViewAndAdvancedQuery
}; };
~Musermgt(); ~Musermgt();
public slots: public slots:
void refresh(bool iResetPageBol = true); //刷新表格信息 void refresh(bool iResetPageBol = true); //刷新表格信息
void refreshDetail(const QString &iUid); //刷新右侧详细信息 void refreshDetail(const QString &iUid); //刷新右侧详细信息
void reload(); //详细表单刷新后重新载入数据 void reload(); //详细表单刷新后重新载入数据
bool DetailModified() const; //用于判断详细表单的数据是否发生改变 bool DetailModified() const; //用于判断详细表单的数据是否发生改变
void setIsDetailModified(bool iIsDetailModified); //设置详细表单的状态(是否发生改变) void setIsDetailModified(bool iIsDetailModified); //设置详细表单的状态(是否发生改变)
QVariantList selectedItems(); //返回选中的表格数据LIST
void newItem(); //"新建"功能 void newItem(); //"新建"功能
void addUser(); //新增用户,对应action-保存 void saveItem(); //保存用户信息,对应action-保存
void removeUser(const QVariantList &iItems); //删除表格里的用户,对应右键菜单里的action-删除 void removeUser(const QVariantList &iItems); //删除表格里的用户,对应右键菜单里的action-删除
QString detailUid() const; //返回当前条目的uid
void setDetailUid(const QString &iUid, bool iForceRefresh = false); //设置条目的uid void setDetailUid(const QString &iUid, bool iForceRefresh = false); //设置条目的uid
void setData(const QVariantMap &iDataMap);
QVariantList selectedItems(); //返回选中的表格数据LIST
QString detailUid() const; //返回当前条目的uid
private slots: private slots:
void onPageChanged(); //翻页对应的槽函数 void onPageChanged(); //翻页对应的槽函数
void onSelectionChanged(); //当表单中选择改变时对应的槽函数 void onSelectionChanged(); //当表单中选择改变时对应的槽函数
...@@ -54,14 +50,15 @@ private slots: ...@@ -54,14 +50,15 @@ private slots:
signals: signals:
void isDetailModifiedChanged(bool iIsDetailModified); //详细表单发生改变时发射该信号 void isDetailModifiedChanged(bool iIsDetailModified); //详细表单发生改变时发射该信号
void detailUidChanged(const QString &iDetailUid); //当左侧选中条目改变时详细表单的UID变化,发送该信号刷新详细表单 void detailUidChanged(const QString &iDetailUid); //当左侧选中条目改变时详细表单的UID变化,发送该信号刷新详细表单
void detailSaved(const QString &iUid); //当详细表单数据保存时发送 void detailSaved(const QVariant &iUid); //当详细表单数据保存时发送
void selectionChanged(); //左侧表单选中条目变化时发送该信号 void selectionChanged(); //左侧表单选中条目变化时发送该信号
private: private:
void initAdvanceCfgMap();
void initTableView(); //初始化界面 void initTableView(); //初始化界面
void initNavi();
Musermgt::NaviType str2NaviType(const QString &iType); Musermgt::NaviType str2NaviType(const QString &iType);
QVariantList parseCategoryConfig(); QVariantList parseCategoryConfig();
QVariantMap getDefaultQueryDataFromCfgMap();
private: private:
TSplitter *mBodySplitter = nullptr; TSplitter *mBodySplitter = nullptr;
TSplitter *mBodyWidget = nullptr; TSplitter *mBodyWidget = nullptr;
...@@ -72,17 +69,12 @@ private: ...@@ -72,17 +69,12 @@ private:
QWidget *mBodyWgt = nullptr; QWidget *mBodyWgt = nullptr;
QString mLastDetailUid; QString mLastDetailUid;
QString mDetailUid; QString mDetailUid;
NaviType mNaviType = NaviType::CategoryTreeView; NaviType mNaviType = NaviType::CategoryTreeView;
QWidget *mNaviView = nullptr; QWidget *mNaviView = nullptr;
QVariantMap mAdvancedQueryCfgMap; QVariantMap mAdvancedQueryCfgMap;
bool IsDetailchange = false; bool IsDetailchange = false;
TopClassTableConf mTableConf; TopClassTableConf mTableConf;
QTimer *mRefreshTimer = nullptr;
QVariantList mSelectedItems; QVariantList mSelectedItems;
void initAdvanceCfgMap();
QVariantMap getDefaultQueryDataFromCfgMap();
}; };
#endif //MUSERMGT #endif //MUSERMGT
HEADERS += \ HEADERS += \
$$PWD/musermgt.h \ $$PWD/sysusermgt.h
SOURCES += \ SOURCES += \
$$PWD/musermgt.cpp \ $$PWD/sysusermgt.cpp
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>QObject</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="559"/>
<source>Title</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="560"/>
<source>Title(English)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="561"/>
<source>Title(Chinese Simplified)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="562"/>
<source>Title(Chinese Tranditional)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="563"/>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="76"/>
<source>Icon Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="564"/>
<source>Search Code</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="565"/>
<source>Layout Size</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="566"/>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="85"/>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="78"/>
<source>Background Color</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="567"/>
<source>Url Address</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="86"/>
<source>Background Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="87"/>
<source>DockArea Alignment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="88"/>
<source>Horizontal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="89"/>
<source>Vertical</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="90"/>
<source>Module Click Type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="91"/>
<source>Double Click</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="92"/>
<source>Click</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="72"/>
<source>GroupName</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="73"/>
<source>GroupName(English)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="74"/>
<source>GroupName(Chinese Simplified)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="75"/>
<source>GroupName(Chinese Tranditional)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="77"/>
<source>Title Color</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="79"/>
<source>Size</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="80"/>
<source>Top Left</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="81"/>
<source>Top</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="82"/>
<source>Top Right</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="83"/>
<source>Left</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="84"/>
<source>Center</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="85"/>
<source>Right</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="86"/>
<source>Bottom Left</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="87"/>
<source>Bottom</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="88"/>
<source>Bottom Right</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="89"/>
<source>Absolute Position</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="90"/>
<source>Dock Area</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="91"/>
<source>Dock Sequence</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TopDesktopItemAbs</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="214"/>
<source>1X1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="218"/>
<source>2X1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="222"/>
<source>2X2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="226"/>
<source>2X4</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="230"/>
<source>4X1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="234"/>
<source>4X2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="238"/>
<source>4x4</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="253"/>
<source>Adjust size</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="257"/>
<source>Setting Module</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="258"/>
<source>Delete Module</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TopQuickButtonV2</name>
<message>
<location filename="sysmainwindowv2/topquickbuttonv2.cpp" line="200"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topquickbuttonv2.cpp" line="211"/>
<source>Unpin On Toolbar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topquickbuttonv2.cpp" line="217"/>
<source>Pin On Toolbar</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TopWin8Desktop</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="145"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="156"/>
<source>Refresh</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="161"/>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="759"/>
<source>Edit Desktop</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="166"/>
<source>Save Desktop</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="171"/>
<source>Desktop Config</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="176"/>
<source>Add Group</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="428"/>
<source>Open File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="428"/>
<source>Images (*.png *.jpeg *.jpg)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="448"/>
<source>Copy image to resource directory failed.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="553"/>
<source>Unknow Error!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="590"/>
<source>Edit Config</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="754"/>
<source>Cancel Edit</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TopWin8DesktopGroup</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="629"/>
<source>Edit - %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="634"/>
<source>New Group</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="666"/>
<source>Are you sure to delete category group %1?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="669"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="670"/>
<source>Yes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="670"/>
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="734"/>
<source>Setting Group</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="735"/>
<source>Delete Group</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="736"/>
<source>Add Module</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TopWin8DesktopItem</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="752"/>
<source>Edit - %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="757"/>
<source>New Module</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN">
<context>
<name>QObject</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="559"/>
<source>Title</source>
<translation>标题</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="560"/>
<source>Title(English)</source>
<translation>标题(英文)</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="561"/>
<source>Title(Chinese Simplified)</source>
<translation>标题(简体中文)</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="562"/>
<source>Title(Chinese Tranditional)</source>
<translation>标题(繁体中文)</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="563"/>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="76"/>
<source>Icon Name</source>
<translation>图标</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="564"/>
<source>Search Code</source>
<translation>搜索码</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="565"/>
<source>Layout Size</source>
<translation>尺寸</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="566"/>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="85"/>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="78"/>
<source>Background Color</source>
<translation>背景色</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="567"/>
<source>Url Address</source>
<translation>模块地址</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="86"/>
<source>Background Image</source>
<translation>背景图片</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="87"/>
<source>DockArea Alignment</source>
<translation>停靠区域对齐</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="81"/>
<source>Top</source>
<translation></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="91"/>
<source>Double Click</source>
<oldsource>Left Dock</oldsource>
<translation>鼠标双击</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="88"/>
<source>Horizontal</source>
<translation>水平</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="89"/>
<source>Vertical</source>
<translation>垂直</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="90"/>
<source>Module Click Type</source>
<translation>如何打开模块</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="92"/>
<source>Click</source>
<translation>鼠标单击</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="72"/>
<source>GroupName</source>
<translation>组名</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="73"/>
<source>GroupName(English)</source>
<translation>组名(英文)</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="74"/>
<source>GroupName(Chinese Simplified)</source>
<translation>组名(简体中文)</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="75"/>
<source>GroupName(Chinese Tranditional)</source>
<translation>组名(繁体中文)</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="77"/>
<source>Title Color</source>
<translation>标题颜色</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="79"/>
<source>Size</source>
<translation>尺寸</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="80"/>
<source>Top Left</source>
<translation>左上</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="82"/>
<source>Top Right</source>
<translation>右上</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="83"/>
<source>Left</source>
<translation></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="84"/>
<source>Center</source>
<translation>中间</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="85"/>
<source>Right</source>
<translation></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="86"/>
<source>Bottom Left</source>
<translation>左下</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="87"/>
<source>Bottom</source>
<translation></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="88"/>
<source>Bottom Right</source>
<translation>右下</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="89"/>
<source>Absolute Position</source>
<translation>绝对位置</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="90"/>
<source>Dock Area</source>
<translation>停靠区域</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="91"/>
<source>Dock Sequence</source>
<translation>停靠序列</translation>
</message>
</context>
<context>
<name>TopDesktopItemAbs</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="214"/>
<source>1X1</source>
<translation></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="218"/>
<source>2X1</source>
<translation></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="222"/>
<source>2X2</source>
<translation></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="226"/>
<source>2X4</source>
<translation></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="230"/>
<source>4X1</source>
<translation></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="234"/>
<source>4X2</source>
<translation></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="238"/>
<source>4x4</source>
<translation></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="253"/>
<source>Adjust size</source>
<translation>调整大小</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="257"/>
<source>Setting Module</source>
<translation>模块设置</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="258"/>
<source>Delete Module</source>
<translation>删除模块</translation>
</message>
</context>
<context>
<name>TopQuickButtonV2</name>
<message>
<location filename="sysmainwindowv2/topquickbuttonv2.cpp" line="200"/>
<source>Close</source>
<translation>关闭</translation>
</message>
<message>
<location filename="sysmainwindowv2/topquickbuttonv2.cpp" line="211"/>
<source>Unpin On Toolbar</source>
<translation>取消固定</translation>
</message>
<message>
<location filename="sysmainwindowv2/topquickbuttonv2.cpp" line="217"/>
<source>Pin On Toolbar</source>
<translation>固定在工具栏上</translation>
</message>
</context>
<context>
<name>TopWin8Desktop</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="145"/>
<source>Search</source>
<translation>搜索</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="156"/>
<source>Refresh</source>
<translation>刷新</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="161"/>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="759"/>
<source>Edit Desktop</source>
<translation>编辑桌面</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="166"/>
<source>Save Desktop</source>
<translation>保存桌面</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="171"/>
<source>Desktop Config</source>
<translation>桌面配置</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="176"/>
<source>Add Group</source>
<translation>添加组</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="428"/>
<source>Open File</source>
<translation>打开文件</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="428"/>
<source>Images (*.png *.jpeg *.jpg)</source>
<translation></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="448"/>
<source>Copy image to resource directory failed.</source>
<translation>拷贝图片到资源目录失败。</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="553"/>
<source>Unknow Error!</source>
<translation>未知错误!</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="590"/>
<source>Edit Config</source>
<translation>编辑配置</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="754"/>
<source>Cancel Edit</source>
<translation>取消编辑</translation>
</message>
</context>
<context>
<name>TopWin8DesktopGroup</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="629"/>
<source>Edit - %1</source>
<translation>编辑 - %1</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="634"/>
<source>New Group</source>
<translation>新建组</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="666"/>
<source>Are you sure to delete category group %1?</source>
<translation>确定要删除%1组吗?</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="669"/>
<source>Delete</source>
<translation>删除</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="670"/>
<source>Yes</source>
<translation>确定</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="670"/>
<source>No</source>
<translation>取消</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="734"/>
<source>Setting Group</source>
<translation>组设置</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="735"/>
<source>Delete Group</source>
<translation>删除组</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="736"/>
<source>Add Module</source>
<translation>添加模块</translation>
</message>
</context>
<context>
<name>TopWin8DesktopItem</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="752"/>
<source>Edit - %1</source>
<translation>编辑 - %1</translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="757"/>
<source>New Module</source>
<translation>添加模块</translation>
</message>
</context>
</TS>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>QObject</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="559"/>
<source>Title</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="560"/>
<source>Title(English)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="561"/>
<source>Title(Chinese Simplified)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="562"/>
<source>Title(Chinese Tranditional)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="563"/>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="76"/>
<source>Icon Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="564"/>
<source>Search Code</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="565"/>
<source>Layout Size</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="566"/>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="85"/>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="78"/>
<source>Background Color</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="567"/>
<source>Url Address</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="86"/>
<source>Background Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="87"/>
<source>DockArea Alignment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="88"/>
<source>Horizontal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="89"/>
<source>Vertical</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="90"/>
<source>Module Click Type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="91"/>
<source>Double Click</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="92"/>
<source>Click</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="72"/>
<source>GroupName</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="73"/>
<source>GroupName(English)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="74"/>
<source>GroupName(Chinese Simplified)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="75"/>
<source>GroupName(Chinese Tranditional)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="77"/>
<source>Title Color</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="79"/>
<source>Size</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="80"/>
<source>Top Left</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="81"/>
<source>Top</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="82"/>
<source>Top Right</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="83"/>
<source>Left</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="84"/>
<source>Center</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="85"/>
<source>Right</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="86"/>
<source>Bottom Left</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="87"/>
<source>Bottom</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="88"/>
<source>Bottom Right</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="89"/>
<source>Absolute Position</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="90"/>
<source>Dock Area</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="91"/>
<source>Dock Sequence</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TopDesktopItemAbs</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="214"/>
<source>1X1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="218"/>
<source>2X1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="222"/>
<source>2X2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="226"/>
<source>2X4</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="230"/>
<source>4X1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="234"/>
<source>4X2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="238"/>
<source>4x4</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="253"/>
<source>Adjust size</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="257"/>
<source>Setting Module</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="258"/>
<source>Delete Module</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TopQuickButtonV2</name>
<message>
<location filename="sysmainwindowv2/topquickbuttonv2.cpp" line="200"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topquickbuttonv2.cpp" line="211"/>
<source>Unpin On Toolbar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topquickbuttonv2.cpp" line="217"/>
<source>Pin On Toolbar</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TopWin8Desktop</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="145"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="156"/>
<source>Refresh</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="161"/>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="759"/>
<source>Edit Desktop</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="166"/>
<source>Save Desktop</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="171"/>
<source>Desktop Config</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="176"/>
<source>Add Group</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="428"/>
<source>Open File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="428"/>
<source>Images (*.png *.jpeg *.jpg)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="448"/>
<source>Copy image to resource directory failed.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="553"/>
<source>Unknow Error!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="590"/>
<source>Edit Config</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktop.cpp" line="754"/>
<source>Cancel Edit</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TopWin8DesktopGroup</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="629"/>
<source>Edit - %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="634"/>
<source>New Group</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="666"/>
<source>Are you sure to delete category group %1?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="669"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="670"/>
<source>Yes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="670"/>
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="734"/>
<source>Setting Group</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="735"/>
<source>Delete Group</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topwin8desktopgroup.cpp" line="736"/>
<source>Add Module</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TopWin8DesktopItem</name>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="752"/>
<source>Edit - %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="sysmainwindowv2/topdesktop/topdesktopitemabs.cpp" line="757"/>
<source>New Module</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
# 模块标题 # 模块标题
sys_title: "System Config" sys_title: "Module Menu"
sys_title_en: "" sys_title_en: ""
sys_title_zhcn: "系统设置" sys_title_zhcn: "模块菜单"
sys_title_zhtw: "" sys_title_zhtw: ""
# 模块图标(普通图标在font awesome中找 http://fontawesome.io/icons/) # 模块图标(普通图标在font awesome中找 http://fontawesome.io/icons/)
sys_icon: "toplinker-cd" sys_icon: "toplinker-cd"
# 模块对应的插件DLL名称 # 模块对应的插件DLL名称
sys_plugin: "musermgt-plugin" sys_plugin: "topikm6-topsys-plugin"
# 模块对应的类名 # 模块对应的类名
sys_class: "SysMainWindow" sys_class: "SysMainWindow"
......
try {
this.addUser();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "plus"
LABEL: "Add"
LABEL_ZHCN: "添加客户"
LABEL_ZHTW: "添加客戶"
ACCEL: "Ctrl+N"
TOOLTIP: "Add Customer"
TOOLTIP_ZHCN: "添加客户"
TOOLTIP_ZHTW: "添加客戶"
CHECKED: ""
GROUP: ""
LABEL_EN: ""
LABEL_JP: ""
TOOLTIP_EN: ""
TOOLTIP_JP: ""
PERMISSION: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.state() != 'EDIT') ? 'enable' : 'hide';"
---ACTION---*/
\ No newline at end of file
try {
this.copy();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "copy"
LABEL: "Copy"
LABEL_ZHCN: "复制"
LABEL_ZHTW: "複製"
ACCEL: ""
TOOLTIP: "Copy"
TOOLTIP_ZHCN: "复制"
TOOLTIP_ZHTW: "複製"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return this.DetailModified() ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
try { try {
this.addUser(); this.saveItem();
} catch(e) { } catch(e) {
print(e); print(e);
} }
......
...@@ -12,16 +12,12 @@ ...@@ -12,16 +12,12 @@
name: 'formlayout', name: 'formlayout',
type: 'FormGridLayout', type: 'FormGridLayout',
property: { property: {
// label_alignment: 'AlignTop | AlignRight',
// horizontal_spacing: 10,
// vertical_spacing: 10,
// margin: 10,
columns: 2 columns: 2
}, },
child: [ child: [
{ {
name: "id", name: "id",
type: "LineEdit", type: "IntLineEdit",
title: self.ttr(""), title: self.ttr(""),
pack: {column_span: 2}, pack: {column_span: 2},
initCallback: function(obj,value,self) { initCallback: function(obj,value,self) {
...@@ -48,7 +44,7 @@ ...@@ -48,7 +44,7 @@
if (val.trim() == '') { if (val.trim() == '') {
return [title + self.ttr(" can not be null"), 'Error']; return [title + self.ttr(" can not be null"), 'Error'];
} else if (!val.match(new RegExp('^[A-Za-z0-9_]+$'))) { } else if (!val.match(new RegExp('^[A-Za-z0-9_]+$'))) {
return [title + self.ttr(" can only contain [A-Za-z0-9]!"), 'Error']; return [title + self.ttr("can only contain [A-Za-z0-9]!"), 'Error'];
} }
}, },
}, },
...@@ -63,7 +59,7 @@ ...@@ -63,7 +59,7 @@
}, },
{ {
name: "attr_data.age", name: "attr_data.age",
type: "LineEdit", type: "IntLineEdit",
title: self.ttr("Age"), title: self.ttr("Age"),
validate: function (obj, val, title, moment, self) { validate: function (obj, val, title, moment, self) {
if (!val.match(new RegExp('^[0-9_]+$'))) { if (!val.match(new RegExp('^[0-9_]+$'))) {
......
...@@ -3,26 +3,14 @@ ...@@ -3,26 +3,14 @@
"Navigation": {en: "Navigation", zhcn: "导航栏", zhtw: "導航欄"} "Navigation": {en: "Navigation", zhcn: "导航栏", zhtw: "導航欄"}
"Display Navigation": {en: "Display Navigation", zhcn: "显示导航栏", zhtw: "顯示導航欄"} "Display Navigation": {en: "Display Navigation", zhcn: "显示导航栏", zhtw: "顯示導航欄"}
"Hide Navigation": {en: "Hide Navigation", zhcn: "隐藏导航栏", zhtw: "隱藏導航欄"} "Hide Navigation": {en: "Hide Navigation", zhcn: "隐藏导航栏", zhtw: "隱藏導航欄"}
"Catergory": {en: "Catergory", zhcn: "分类", zhtw: "分類"}
"Password": {en: "Password", zhcn: "密码", zhtw: "密码"} "Password": {en: "Password", zhcn: "密码", zhtw: "密码"}
"UserName": {en: "UserName", zhcn: "用户名", zhtw: "用户名"} "UserName": {en: "UserName", zhcn: "用户名", zhtw: "用户名"}
"FullName": {en: "FullName", zhcn: "全名", zhtw: "全名"} "FullName": {en: "FullName", zhcn: "全名", zhtw: "全名"}
"Status": {en: "Status", zhcn: "状态", zhtw: "状态"} "Status": {en: "Status", zhcn: "状态", zhtw: "状态"}
"Class": {en: "Maintenance Class", zhcn: "维护类型", zhtw: "維護類型"}
"Load data successful!": {en: "Load data successful!" ,zhcn: "加载数据完成!" ,zhtw: "加載數據完成!"} "Load data successful!": {en: "Load data successful!" ,zhcn: "加载数据完成!" ,zhtw: "加載數據完成!"}
"Exec Plan": {en: "Exec Plan", zhcn: "执行计划", zhtw: "執行計劃"}
"Class": {en: "Maintenance Class", zhcn: "维护类型", zhtw: ""}
"Choose": {en: "Choose", zhcn: "选择", zhtw: "選擇"} "Choose": {en: "Choose", zhcn: "选择", zhtw: "選擇"}
"Choose Machine": {en: "Choose Machine", zhcn: "选择设备", zhtw: "選擇設備"}
"Choose Person": {en: "Choose Person", zhcn: "选择人员", zhtw: "選擇人員"}
"Record No": {en: "Record No", zhcn: "记录单号", zhtw: "記錄單號"}
"Apply Time": {en: "Apply Time", zhcn: "申请时间", zhtw: "申請時間"}
"Apply Person": {en: "Apply Person", zhcn: "申请人", zhtw: "申請人"}
"Start Time": {en: "Start Time", zhcn: "开始时间", zhtw: "開始時間"}
"End Time": {en: "End Time", zhcn: "结束时间", zhtw: "結束時間"}
"Basic Info": {en: "Basic Info", zhcn: "基本信息", zhtw: "基本信息"}
"Ok": {en: "OK", zhcn: "确定", zhtw: "確定"} "Ok": {en: "OK", zhcn: "确定", zhtw: "確定"}
"Cancel": {en: "Cancel", zhcn: "取消", zhtw: "取消"} "Cancel": {en: "Cancel", zhcn: "取消", zhtw: "取消"}
"Cycle Value": {en: "Cycle Value", zhcn: "周期", zhtw: "週期"}
"Cycle Unit": {en: "Cycle Unit", zhcn: "周期单位", zhtw: "週期單位"}
"Name": {en: "Name", zhcn: "姓名", zhtw: "姓名"} "Name": {en: "Name", zhcn: "姓名", zhtw: "姓名"}
"can only contain [A-Za-z0-9]!": {en: "can only contain [A-Za-z0-9]!", zhcn: "只能包含A-Z,a-z,0-9!",zhtw: "只能包含A-Z,a-z,0-9!"}
"Are you sure you are a hundred years old?": {en: "Are you sure you are a hundred years old?", zhcn: "你确定你有这么老/这么小?", zhtw: "你确定你有这么老/这么小?"}
\ No newline at end of file
# 模块标题 # 模块标题
sys_title: "My test program" sys_title: "Custom module"
sys_title_en: "My test program" sys_title_en: "Custom module"
sys_title_zhcn: "我的测试程序" sys_title_zhcn: "自定义模块"
sys_title_zhtw: "" sys_title_zhtw: ""
# 模块图标 # 模块图标
sys_icon: "wpforms" sys_icon: "wpforms"
# 模块对应的插件DLL名称 # 模块对应的插件DLL名称
sys_plugin: "musermgt-plugin" sys_plugin: "topikm6-custommodule-plugin"
# 模块对应的类名 # 模块对应的类名
sys_class: "Musermgt" sys_class: "Musermgt"
# 许可证验证键 # 许可证验证键
...@@ -21,7 +21,9 @@ sys_save_action: "" ...@@ -21,7 +21,9 @@ sys_save_action: ""
sys_enum_list: [] sys_enum_list: []
# 该模块用到的除了Action之外的权限列表 # 该模块用到的除了Action之外的权限列表
sys_permission_list: [] sys_permission_list: []
# 导航栏 default_value : {
password: "123456",
}
# 主表格 # 主表格
view { view {
...@@ -40,33 +42,33 @@ view { ...@@ -40,33 +42,33 @@ view {
}, },
{ {
"name": "username", "name": "username",
"display": "登录名", "display": "UserName",
"displayRole": "$username", "displayRole": "$username",
"size": 100 "size": 100
}, },
{ {
"name": "fullname", "name": "fullname",
"display": "全名", "display": "FullName",
"displayRole": "$fullname", "displayRole": "$fullname",
"size": 100, "size": 100,
"search": "string" "search": "string"
}, },
{ {
"name": "status", "name": "status",
"display": "状态", "display": "status",
"displayRole": "$status.text", "displayRole": "$status.text",
"size": 100, "size": 100,
"format": "enum(tpm-machine-maintenance-plan-status)" "format": "enum(tpm-machine-maintenance-plan-status)"
}, },
{ {
"name": "attr_data.age", "name": "attr_data.age",
"display": "年龄", "display": "Age",
"displayRole": "$attr_data.age", "displayRole": "$attr_data.age",
"size": 100 "size": 100
}, },
{ {
"name": "attr_data.gender", "name": "attr_data.gender",
"display": "性别", "display": "Gender",
"displayRole": "$attr_data.gender.text", "displayRole": "$attr_data.gender.text",
"size": 100 "size": 100
"format": "enum(tpm-machine-maintenance-plan-gender)" "format": "enum(tpm-machine-maintenance-plan-gender)"
......
try {
this.addUser();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "plus"
LABEL: "Add"
LABEL_ZHCN: "添加客户"
LABEL_ZHTW: "添加客戶"
ACCEL: "Ctrl+N"
TOOLTIP: "Add Customer"
TOOLTIP_ZHCN: "添加客户"
TOOLTIP_ZHTW: "添加客戶"
CHECKED: ""
GROUP: ""
LABEL_EN: ""
LABEL_JP: ""
TOOLTIP_EN: ""
TOOLTIP_JP: ""
PERMISSION: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.state() != 'EDIT') ? 'enable' : 'hide';"
---ACTION---*/
\ No newline at end of file
try {
this.copy();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "copy"
LABEL: "Copy"
LABEL_ZHCN: "复制"
LABEL_ZHTW: "複製"
ACCEL: ""
TOOLTIP: "Copy"
TOOLTIP_ZHCN: "复制"
TOOLTIP_ZHTW: "複製"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return this.DetailModified() ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
...@@ -4,27 +4,27 @@ try { ...@@ -4,27 +4,27 @@ try {
if (ans != 'Yes') { if (ans != 'Yes') {
return; return;
} }
this.removeUser(this.selectedItems()); this.deleteItems(this.selectedItems());
} catch (e) { } catch (e) {
print(e); print(e);
} }
/*---ACTION--- /*---ACTION---
ICON: "times-circle" ICON: "times-circle"
LABEL: "Delete" LABEL: "Delete"
LABEL_ZHCN: "刪除" LABEL_ZHCN: "刪除"
LABEL_ZHTW: "刪除" LABEL_ZHTW: "刪除"
ACCEL: "Delete" ACCEL: "Delete"
TOOLTIP: "Delete" TOOLTIP: "Delete"
TOOLTIP_ZHCN: "删除" TOOLTIP_ZHCN: "删除"
TOOLTIP_ZHTW: "刪除" TOOLTIP_ZHTW: "刪除"
PERMISSION: "" PERMISSION: ""
CHECKED: "" CHECKED: ""
GROUP: "" GROUP: ""
STYLE: "size=small button_style=both" STYLE: "size=small button_style=both"
LANG: "JavaScript" LANG: "JavaScript"
STATUS: "Release" STATUS: "Release"
VERSION: "1" VERSION: "1"
STATEHOOK: "if(this.selectedItems().length > 0 && !this.DetailModified()){return 'enable'}else{return 'disable'}" STATEHOOK: "if(this.selectedItems().length > 0 && !this.isDetailModified()){return 'enable'}else{return 'disable'}"
---ACTION---*/ ---ACTION---*/
\ No newline at end of file \ No newline at end of file
...@@ -20,5 +20,5 @@ STYLE: "button_style=both" ...@@ -20,5 +20,5 @@ STYLE: "button_style=both"
LANG: "JavaScript" LANG: "JavaScript"
STATUS: "Release" STATUS: "Release"
VERSION: "1" VERSION: "1"
STATEHOOK: "if (!this.DetailModified()){return 'enable'} else {return 'disable'}" STATEHOOK: "if (!this.isDetailModified()){return 'enable'} else {return 'disable'}"
---ACTION---*/ ---ACTION---*/
\ No newline at end of file
...@@ -12,16 +12,12 @@ ...@@ -12,16 +12,12 @@
name: 'formlayout', name: 'formlayout',
type: 'FormGridLayout', type: 'FormGridLayout',
property: { property: {
// label_alignment: 'AlignTop | AlignRight',
// horizontal_spacing: 10,
// vertical_spacing: 10,
// margin: 10,
columns: 2 columns: 2
}, },
child: [ child: [
{ {
name: "id", name: "id",
type: "LineEdit", type: "IntLineEdit",
title: self.ttr(""), title: self.ttr(""),
pack: {column_span: 2}, pack: {column_span: 2},
initCallback: function(obj,value,self) { initCallback: function(obj,value,self) {
...@@ -48,7 +44,7 @@ ...@@ -48,7 +44,7 @@
if (val.trim() == '') { if (val.trim() == '') {
return [title + self.ttr(" can not be null"), 'Error']; return [title + self.ttr(" can not be null"), 'Error'];
} else if (!val.match(new RegExp('^[A-Za-z0-9_]+$'))) { } else if (!val.match(new RegExp('^[A-Za-z0-9_]+$'))) {
return [title + self.ttr(" can only contain [A-Za-z0-9]!"), 'Error']; return [title + self.ttr("can only contain [A-Za-z0-9]!"), 'Error'];
} }
}, },
}, },
...@@ -63,7 +59,7 @@ ...@@ -63,7 +59,7 @@
}, },
{ {
name: "attr_data.age", name: "attr_data.age",
type: "LineEdit", type: "IntLineEdit",
title: self.ttr("Age"), title: self.ttr("Age"),
validate: function (obj, val, title, moment, self) { validate: function (obj, val, title, moment, self) {
if (!val.match(new RegExp('^[0-9_]+$'))) { if (!val.match(new RegExp('^[0-9_]+$'))) {
......
...@@ -13,3 +13,5 @@ ...@@ -13,3 +13,5 @@
"Ok": {en: "OK", zhcn: "确定", zhtw: "確定"} "Ok": {en: "OK", zhcn: "确定", zhtw: "確定"}
"Cancel": {en: "Cancel", zhcn: "取消", zhtw: "取消"} "Cancel": {en: "Cancel", zhcn: "取消", zhtw: "取消"}
"Name": {en: "Name", zhcn: "姓名", zhtw: "姓名"} "Name": {en: "Name", zhcn: "姓名", zhtw: "姓名"}
"can only contain [A-Za-z0-9]!": {en: "can only contain [A-Za-z0-9]!", zhcn: "只能包含A-Z,a-z,0-9!",zhtw: "只能包含A-Z,a-z,0-9!"}
"Are you sure you are a hundred years old?": {en: "Are you sure you are a hundred years old?", zhcn: "你确定你有这么老/这么小?", zhtw: "你确定你有这么老/这么小?"}
\ No newline at end of file
...@@ -22,7 +22,13 @@ sys_enum_list: [] ...@@ -22,7 +22,13 @@ sys_enum_list: []
# 该模块用到的除了Action之外的权限列表 # 该模块用到的除了Action之外的权限列表
sys_permission_list: [] sys_permission_list: []
navi: {
__type__:NONE
}
default_value : {
password: "123456"
}
# 主表格 # 主表格
view { view {
# 数据项, 默认包含表头中配置的数据项 # 数据项, 默认包含表头中配置的数据项
...@@ -40,33 +46,33 @@ view { ...@@ -40,33 +46,33 @@ view {
}, },
{ {
"name": "username", "name": "username",
"display": "登录名", "display": "UserName",
"displayRole": "$username", "displayRole": "$username",
"size": 100 "size": 100
}, },
{ {
"name": "fullname", "name": "fullname",
"display": "全名", "display": "FullName",
"displayRole": "$fullname", "displayRole": "$fullname",
"size": 100, "size": 100,
"search": "string" "search": "string"
}, },
{ {
"name": "status", "name": "status",
"display": "状态", "display": "status",
"displayRole": "$status.text", "displayRole": "$status.text",
"size": 100, "size": 100,
"format": "enum(tpm-machine-maintenance-plan-status)" "format": "enum(tpm-machine-maintenance-plan-status)"
}, },
{ {
"name": "attr_data.age", "name": "attr_data.age",
"display": "年龄", "display": "Age",
"displayRole": "$attr_data.age", "displayRole": "$attr_data.age",
"size": 100 "size": 100
}, },
{ {
"name": "attr_data.gender", "name": "attr_data.gender",
"display": "性别", "display": "Gender",
"displayRole": "$attr_data.gender.text", "displayRole": "$attr_data.gender.text",
"size": 100 "size": 100
"format": "enum(tpm-machine-maintenance-plan-gender)" "format": "enum(tpm-machine-maintenance-plan-gender)"
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
"DETAIL_TOOLBAR": [ "DETAIL_TOOLBAR": [
{"type":"toolitem","action":"save_detail"}, {"type":"toolitem","action":"save_detail"},
{"type":"stretcher"}, {"type":"stretcher"},
{"type":"toolitem","action":"copy_detail"},
{"type":"toolitem","action":"cancel_detail"}, {"type":"toolitem","action":"cancel_detail"},
{"type":"toolitem","action":"refresh_detail"} {"type":"toolitem","action":"refresh_detail"}
] ]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment