add icon and new workspace
This commit is contained in:
parent
f4b93f7278
commit
ff462c7bd9
@ -19,7 +19,7 @@ FILE(GLOB_RECURSE CPP_FILES ./*.cpp common/*.cpp model/*.cpp app/*.cpp)
|
|||||||
FILE(GLOB_RECURSE CC_FILES ./*.cc)
|
FILE(GLOB_RECURSE CC_FILES ./*.cc)
|
||||||
FILE(GLOB_RECURSE UI_FILES ./*.ui)
|
FILE(GLOB_RECURSE UI_FILES ./*.ui)
|
||||||
FILE(GLOB_RECURSE QRC_FILES ./*.qrc)
|
FILE(GLOB_RECURSE QRC_FILES ./*.qrc)
|
||||||
FILE(GLOB_RECURSE RC_FILES res/*.rc)
|
FILE(GLOB_RECURSE RC_FILES ./res/*.rc)
|
||||||
|
|
||||||
SET(
|
SET(
|
||||||
TS_FILES
|
TS_FILES
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
IDI_ICON ICON DISCARDABLE ".\\res\\sys_icon.ico"
|
BIN
src/res/sys_icon.ico
Normal file
BIN
src/res/sys_icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
@ -1704,43 +1704,47 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="29"/>
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="43"/>
|
||||||
<source>1</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="40"/>
|
|
||||||
<source>Path</source>
|
<source>Path</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="47"/>
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="32"/>
|
||||||
<source>d:/hysw</source>
|
<source>input workspace name</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="57"/>
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="56"/>
|
||||||
|
<source>select workspace save path</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="63"/>
|
||||||
<source>...</source>
|
<source>...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="68"/>
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="74"/>
|
||||||
<source>describe</source>
|
<source>describe</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="95"/>
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="101"/>
|
||||||
<source>Sure</source>
|
<source>Sure</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="102"/>
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="108"/>
|
||||||
<source>Cancel</source>
|
<source>Cancel</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="49"/>
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="49"/>
|
||||||
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="55"/>
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="57"/>
|
||||||
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="64"/>
|
||||||
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="73"/>
|
||||||
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="79"/>
|
||||||
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="88"/>
|
||||||
<source>warning</source>
|
<source>warning</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -1750,12 +1754,32 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="55"/>
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="57"/>
|
||||||
|
<source>current path is contains current folder, do you want to overwrite it?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="64"/>
|
||||||
|
<source>removeRecursively failed</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="73"/>
|
||||||
|
<source>mkpath failed</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="79"/>
|
||||||
<source>name is exits</source>
|
<source>name is exits</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="70"/>
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="88"/>
|
||||||
|
<source>create workSpace failed</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="98"/>
|
||||||
<source>save spaceWork directory</source>
|
<source>save spaceWork directory</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -50,6 +50,30 @@ void WorkSpaceDlg::OnSure() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString workspacePath = QString("%1/%2").arg(savePath).arg(name);
|
||||||
|
QDir dir(workspacePath);
|
||||||
|
if (dir.exists()) {
|
||||||
|
LOG_WARN("current path is contains current folder, {}", workspacePath.toStdString());
|
||||||
|
if (QMessageBox::warning(this, tr("warning"), tr("current path is contains current folder, do you want to overwrite it?"),
|
||||||
|
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dir.removeRecursively()) {
|
||||||
|
LOG_WARN("removeRecursively {} failed", workspacePath.toStdString());
|
||||||
|
QMessageBox::warning(this, tr("warning"), tr("removeRecursively failed"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkSpaceManager::Get().Remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dir.mkpath(workspacePath)) {
|
||||||
|
LOG_WARN("mkpath {} failed", workspacePath.toStdString());
|
||||||
|
QMessageBox::warning(this, tr("warning"), tr("mkpath failed"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (WorkSpaceManager::Get().Contains(name)) {
|
if (WorkSpaceManager::Get().Contains(name)) {
|
||||||
LOG_WARN("name is exits");
|
LOG_WARN("name is exits");
|
||||||
QMessageBox::warning(this, tr("warning"), tr("name is exits"));
|
QMessageBox::warning(this, tr("warning"), tr("name is exits"));
|
||||||
@ -58,10 +82,14 @@ void WorkSpaceDlg::OnSure() {
|
|||||||
|
|
||||||
WorkSpace* workSpace = WorkSpaceManager::Get().GetOrCreate(name);
|
WorkSpace* workSpace = WorkSpaceManager::Get().GetOrCreate(name);
|
||||||
workSpace->SetDescribe(ui->etDescribe->toPlainText());
|
workSpace->SetDescribe(ui->etDescribe->toPlainText());
|
||||||
//workSpace->Save(savePath);
|
workspacePath += QString("/%1.dyt").arg(name);
|
||||||
|
if (!workSpace->Save(workspacePath)) {
|
||||||
|
LOG_ERROR("save workSpace failed");
|
||||||
|
QMessageBox::warning(this, tr("warning"), tr("create workSpace failed"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
emit WorkSpaceManager::Get().WorkSpaceChanged(workSpace);
|
emit WorkSpaceManager::Get().WorkSpaceChanged(workSpace);
|
||||||
workSpace->BuildDefault();
|
|
||||||
|
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,10 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="leName">
|
<widget class="QLineEdit" name="leName">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>1</string>
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>input workspace name</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -44,11 +47,14 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lePath">
|
<widget class="QLineEdit" name="lePath">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>d:/hysw</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>select workspace save path</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -157,18 +157,6 @@ bool WorkSpace::Save() {
|
|||||||
return xmlWrite.Save(path_);
|
return xmlWrite.Save(path_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WorkSpace::BuildDefault() {
|
|
||||||
/* WorkSpaceItemGroup* item = new WorkSpaceItemGroup("root", this);
|
|
||||||
AddItem(item, nullptr);
|
|
||||||
WorkSpaceItemGroup* subItem = new WorkSpaceRiverGroup(tr("River0"));
|
|
||||||
AddItem(subItem, item);
|
|
||||||
item = subItem;
|
|
||||||
subItem = new WorkSpaceRiverNetGroup(tr("RiverNet0"));
|
|
||||||
AddItem(subItem, item);*/
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WorkSpace::Load(const QString& dyt) {
|
bool WorkSpace::Load(const QString& dyt) {
|
||||||
WorkSpaceXMLParse parse(this);
|
WorkSpaceXMLParse parse(this);
|
||||||
bool success = parse.Load(dyt);
|
bool success = parse.Load(dyt);
|
||||||
|
@ -70,7 +70,6 @@ public:
|
|||||||
bool Save(const QString& path);
|
bool Save(const QString& path);
|
||||||
bool Save();
|
bool Save();
|
||||||
|
|
||||||
bool BuildDefault();
|
|
||||||
bool Load(const QString& dyt);
|
bool Load(const QString& dyt);
|
||||||
void Unlaod();
|
void Unlaod();
|
||||||
|
|
||||||
|
@ -28,6 +28,19 @@ bool WorkSpaceManager::Contains(const QString& name) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WorkSpaceManager::Remove(const QString& name) {
|
||||||
|
auto itor = workSpaces_.find(name);
|
||||||
|
if (workSpaces_.end() == itor) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkSpace* workspace = itor->second;
|
||||||
|
if (nullptr != workspace) {
|
||||||
|
workspace->deleteLater();
|
||||||
|
}
|
||||||
|
workSpaces_.erase(itor);
|
||||||
|
}
|
||||||
|
|
||||||
WorkSpace* WorkSpaceManager::LoadDyt(const QString& dyt, class OsgView* view) {
|
WorkSpace* WorkSpaceManager::LoadDyt(const QString& dyt, class OsgView* view) {
|
||||||
WorkSpace* workspace = new WorkSpace(view, this);
|
WorkSpace* workspace = new WorkSpace(view, this);
|
||||||
if (!workspace->Load(dyt)) {
|
if (!workspace->Load(dyt)) {
|
||||||
|
@ -20,6 +20,7 @@ public:
|
|||||||
void OnDestory();
|
void OnDestory();
|
||||||
|
|
||||||
bool Contains(const QString& name) const;
|
bool Contains(const QString& name) const;
|
||||||
|
bool Remove(const QString& name);
|
||||||
WorkSpace* LoadDyt(const QString& dyt, class OsgView* view);
|
WorkSpace* LoadDyt(const QString& dyt, class OsgView* view);
|
||||||
WorkSpace* GetOrCreate(const QString& path);
|
WorkSpace* GetOrCreate(const QString& path);
|
||||||
void SetCurrent(WorkSpace* workspace);
|
void SetCurrent(WorkSpace* workspace);
|
||||||
|
Loading…
Reference in New Issue
Block a user