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