mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 22:09:52 +08:00
MainWindow: remember expanded state
This commit is contained in:
parent
dace19119f
commit
b4554e1be8
@ -236,6 +236,12 @@ outline_expanded_level=6
|
|||||||
; [optional] Prefix of the name of inserted images
|
; [optional] Prefix of the name of inserted images
|
||||||
image_name_prefix=
|
image_name_prefix=
|
||||||
|
|
||||||
|
; MainWindow panel view state
|
||||||
|
; 0 - ExpandMode
|
||||||
|
; 1 - HorizontalMode (Not Implemented)
|
||||||
|
; 2 - VerticalMode
|
||||||
|
panel_view_state=2
|
||||||
|
|
||||||
[export]
|
[export]
|
||||||
; Path of the wkhtmltopdf tool
|
; Path of the wkhtmltopdf tool
|
||||||
wkhtmltopdf=wkhtmltopdf
|
wkhtmltopdf=wkhtmltopdf
|
||||||
|
@ -306,6 +306,9 @@ void VConfigManager::initialize()
|
|||||||
|
|
||||||
m_imageNamePrefix = getConfigFromSettings("global",
|
m_imageNamePrefix = getConfigFromSettings("global",
|
||||||
"image_name_prefix").toString();
|
"image_name_prefix").toString();
|
||||||
|
|
||||||
|
m_panelViewState = getConfigFromSettings("global",
|
||||||
|
"panel_view_state").toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VConfigManager::initSettings()
|
void VConfigManager::initSettings()
|
||||||
|
@ -198,6 +198,9 @@ public:
|
|||||||
const QByteArray getTagExplorerSplitterState() const;
|
const QByteArray getTagExplorerSplitterState() const;
|
||||||
void setTagExplorerSplitterState(const QByteArray &p_state);
|
void setTagExplorerSplitterState(const QByteArray &p_state);
|
||||||
|
|
||||||
|
int getPanelViewState() const;
|
||||||
|
void setPanelViewState(int p_state);
|
||||||
|
|
||||||
bool getFindCaseSensitive() const;
|
bool getFindCaseSensitive() const;
|
||||||
void setFindCaseSensitive(bool p_enabled);
|
void setFindCaseSensitive(bool p_enabled);
|
||||||
|
|
||||||
@ -941,6 +944,9 @@ private:
|
|||||||
// Prefix of the name of inserted images.
|
// Prefix of the name of inserted images.
|
||||||
QString m_imageNamePrefix;
|
QString m_imageNamePrefix;
|
||||||
|
|
||||||
|
// State of MainWindow panel view.
|
||||||
|
int m_panelViewState;
|
||||||
|
|
||||||
// The name of the config file in each directory.
|
// The name of the config file in each directory.
|
||||||
static const QString c_dirConfigFile;
|
static const QString c_dirConfigFile;
|
||||||
|
|
||||||
@ -2454,4 +2460,19 @@ inline const QString &VConfigManager::getImageNamePrefix() const
|
|||||||
{
|
{
|
||||||
return m_imageNamePrefix;
|
return m_imageNamePrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline int VConfigManager::getPanelViewState() const
|
||||||
|
{
|
||||||
|
return m_panelViewState;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void VConfigManager::setPanelViewState(int p_state)
|
||||||
|
{
|
||||||
|
if (m_panelViewState == p_state) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_panelViewState = p_state;
|
||||||
|
setConfigToSettings("global", "panel_view_state", m_panelViewState);
|
||||||
|
}
|
||||||
#endif // VCONFIGMANAGER_H
|
#endif // VCONFIGMANAGER_H
|
||||||
|
@ -109,6 +109,13 @@ VMainWindow::VMainWindow(VSingleInstanceGuard *p_guard, QWidget *p_parent)
|
|||||||
|
|
||||||
initDockWindows();
|
initDockWindows();
|
||||||
|
|
||||||
|
int state = g_config->getPanelViewState();
|
||||||
|
if (state < 0 || state >= (int)PanelViewState::Invalid) {
|
||||||
|
state = (int)PanelViewState::VerticalMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
changePanelView((PanelViewState)state);
|
||||||
|
|
||||||
restoreStateAndGeometry();
|
restoreStateAndGeometry();
|
||||||
|
|
||||||
setContextMenuPolicy(Qt::NoContextMenu);
|
setContextMenuPolicy(Qt::NoContextMenu);
|
||||||
@ -2069,9 +2076,12 @@ void VMainWindow::changePanelView(PanelViewState p_state)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Q_ASSERT(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_config->setPanelViewState((int)p_state);
|
||||||
|
|
||||||
expandViewAct->setChecked(p_state == PanelViewState::ExpandMode);
|
expandViewAct->setChecked(p_state == PanelViewState::ExpandMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class VTagExplorer;
|
|||||||
|
|
||||||
enum class PanelViewState
|
enum class PanelViewState
|
||||||
{
|
{
|
||||||
ExpandMode,
|
ExpandMode = 0,
|
||||||
HorizontalMode,
|
HorizontalMode,
|
||||||
VerticalMode,
|
VerticalMode,
|
||||||
Invalid
|
Invalid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user