From 85a5ea6054c24192fcf3f993b9c05bc81f2de3c1 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Sat, 18 Mar 2017 17:51:00 +0800 Subject: [PATCH] open two panels view after locating file --- src/vmainwindow.cpp | 15 ++++++++++++--- src/vmainwindow.h | 5 ++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/vmainwindow.cpp b/src/vmainwindow.cpp index 102735f5..0ff20f54 100644 --- a/src/vmainwindow.cpp +++ b/src/vmainwindow.cpp @@ -18,7 +18,7 @@ extern VConfigManager vconfig; VNote *g_vnote; VMainWindow::VMainWindow(QWidget *parent) - : QMainWindow(parent) + : QMainWindow(parent), m_onePanel(false) { setWindowIcon(QIcon(":/resources/icons/vnote.ico")); vnote = new VNote(this); @@ -758,12 +758,14 @@ void VMainWindow::onePanelView() { changeSplitterView(1); expandViewAct->setChecked(false); + m_onePanel = true; } void VMainWindow::twoPanelView() { changeSplitterView(2); expandViewAct->setChecked(false); + m_onePanel = false; } void VMainWindow::expandPanelView(bool p_checked) @@ -772,7 +774,11 @@ void VMainWindow::expandPanelView(bool p_checked) if (p_checked) { nrSplits = 0; } else { - nrSplits = 2; + if (m_onePanel) { + nrSplits = 1; + } else { + nrSplits = 2; + } } changeSplitterView(nrSplits); } @@ -913,7 +919,7 @@ void VMainWindow::insertImage() m_curTab->insertImage(); } -void VMainWindow::locateFile(VFile *p_file) const +void VMainWindow::locateFile(VFile *p_file) { if (!p_file) { return; @@ -932,6 +938,9 @@ void VMainWindow::locateFile(VFile *p_file) const fileList->locateFile(p_file); } } + + // Open the directory and file panels after location. + changeSplitterView(2); } void VMainWindow::handleFindDialogTextChanged(const QString &p_text, uint /* p_options */) diff --git a/src/vmainwindow.h b/src/vmainwindow.h index d09c9b0c..82059b64 100644 --- a/src/vmainwindow.h +++ b/src/vmainwindow.h @@ -36,7 +36,7 @@ class VMainWindow : public QMainWindow public: VMainWindow(QWidget *parent = 0); const QVector > &getPalette() const; - void locateFile(VFile *p_file) const; + void locateFile(VFile *p_file); private slots: void importNoteFromFile(); @@ -112,6 +112,9 @@ private: VAvatar *m_avatar; VFindReplaceDialog *m_findReplaceDialog; + // Whether it is one panel or two panles. + bool m_onePanel; + // Actions QAction *newRootDirAct; QAction *newNoteAct;