mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 20:40:29 +08:00
refs #619, allow to open file load / save dialog from view
This commit is contained in:
@@ -141,6 +141,16 @@ namespace BlackGui
|
|||||||
return CGuiUtility::mainApplicationWindow();
|
return CGuiUtility::mainApplicationWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CStatusMessage CViewBaseNonTemplate::showFileLoadDialog()
|
||||||
|
{
|
||||||
|
return this->ps_loadJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
CStatusMessage CViewBaseNonTemplate::showFileSaveDialog() const
|
||||||
|
{
|
||||||
|
return this->ps_saveJson();
|
||||||
|
}
|
||||||
|
|
||||||
void CViewBaseNonTemplate::setCustomMenu(IMenuDelegate *menu, bool nestPreviousMenu)
|
void CViewBaseNonTemplate::setCustomMenu(IMenuDelegate *menu, bool nestPreviousMenu)
|
||||||
{
|
{
|
||||||
if (menu && nestPreviousMenu)
|
if (menu && nestPreviousMenu)
|
||||||
@@ -232,8 +242,8 @@ namespace BlackGui
|
|||||||
|
|
||||||
// load/save
|
// load/save
|
||||||
items = menu.actions().size();
|
items = menu.actions().size();
|
||||||
if (m_menus.testFlag(MenuLoad)) { menu.addAction(CIcons::disk16(), "Load from file", this, SLOT(ps_loadJson())); }
|
if (m_menus.testFlag(MenuLoad)) { menu.addAction(CIcons::disk16(), "Load from file", this, &CViewBaseNonTemplate::ps_loadJson); }
|
||||||
if (m_menus.testFlag(MenuSave) && !isEmpty()) { menu.addAction(CIcons::disk16(), "Save data in file", this, SLOT(ps_saveJson()), CShortcut::keySaveViews()); }
|
if (m_menus.testFlag(MenuSave) && !isEmpty()) { menu.addAction(CIcons::disk16(), "Save data in file", this, &CViewBaseNonTemplate::ps_saveJson, CShortcut::keySaveViews()); }
|
||||||
if (menu.actions().size() > items) { menu.addSeparator(); }
|
if (menu.actions().size() > items) { menu.addSeparator(); }
|
||||||
|
|
||||||
// resizing
|
// resizing
|
||||||
@@ -362,10 +372,10 @@ namespace BlackGui
|
|||||||
QString CViewBaseNonTemplate::getDefaultFilename() const
|
QString CViewBaseNonTemplate::getDefaultFilename() const
|
||||||
{
|
{
|
||||||
// some logic to find a useful default name
|
// some logic to find a useful default name
|
||||||
QStringList pathes(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation));
|
const QStringList pathes(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation));
|
||||||
QString name;
|
QString name;
|
||||||
if (getDockWidgetInfoArea()) { name = getDockWidgetInfoArea()->windowTitle(); }
|
if (this->getDockWidgetInfoArea()) { name = this->getDockWidgetInfoArea()->windowTitle(); }
|
||||||
else if (!windowTitle().isEmpty()) { name = windowType(); }
|
else if (!windowTitle().isEmpty()) { name = this->windowType(); }
|
||||||
else { name = this->metaObject()->className(); }
|
else { name = this->metaObject()->className(); }
|
||||||
name += ".json";
|
name += ".json";
|
||||||
|
|
||||||
|
|||||||
@@ -197,6 +197,12 @@ namespace BlackGui
|
|||||||
//! Main application window widget if any
|
//! Main application window widget if any
|
||||||
QWidget *mainApplicationWindowWidget() const;
|
QWidget *mainApplicationWindowWidget() const;
|
||||||
|
|
||||||
|
//! Show file load dialog
|
||||||
|
BlackMisc::CStatusMessage showFileLoadDialog();
|
||||||
|
|
||||||
|
//! Show file save dialog
|
||||||
|
BlackMisc::CStatusMessage showFileSaveDialog() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Ask for new data from currently loaded data
|
//! Ask for new data from currently loaded data
|
||||||
void requestUpdate();
|
void requestUpdate();
|
||||||
|
|||||||
Reference in New Issue
Block a user