open two panels view after locating file

This commit is contained in:
Le Tan 2017-03-18 17:51:00 +08:00
parent a43383acec
commit 85a5ea6054
2 changed files with 16 additions and 4 deletions

View File

@ -18,7 +18,7 @@ extern VConfigManager vconfig;
VNote *g_vnote; VNote *g_vnote;
VMainWindow::VMainWindow(QWidget *parent) VMainWindow::VMainWindow(QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent), m_onePanel(false)
{ {
setWindowIcon(QIcon(":/resources/icons/vnote.ico")); setWindowIcon(QIcon(":/resources/icons/vnote.ico"));
vnote = new VNote(this); vnote = new VNote(this);
@ -758,12 +758,14 @@ void VMainWindow::onePanelView()
{ {
changeSplitterView(1); changeSplitterView(1);
expandViewAct->setChecked(false); expandViewAct->setChecked(false);
m_onePanel = true;
} }
void VMainWindow::twoPanelView() void VMainWindow::twoPanelView()
{ {
changeSplitterView(2); changeSplitterView(2);
expandViewAct->setChecked(false); expandViewAct->setChecked(false);
m_onePanel = false;
} }
void VMainWindow::expandPanelView(bool p_checked) void VMainWindow::expandPanelView(bool p_checked)
@ -772,7 +774,11 @@ void VMainWindow::expandPanelView(bool p_checked)
if (p_checked) { if (p_checked) {
nrSplits = 0; nrSplits = 0;
} else { } else {
nrSplits = 2; if (m_onePanel) {
nrSplits = 1;
} else {
nrSplits = 2;
}
} }
changeSplitterView(nrSplits); changeSplitterView(nrSplits);
} }
@ -913,7 +919,7 @@ void VMainWindow::insertImage()
m_curTab->insertImage(); m_curTab->insertImage();
} }
void VMainWindow::locateFile(VFile *p_file) const void VMainWindow::locateFile(VFile *p_file)
{ {
if (!p_file) { if (!p_file) {
return; return;
@ -932,6 +938,9 @@ void VMainWindow::locateFile(VFile *p_file) const
fileList->locateFile(p_file); fileList->locateFile(p_file);
} }
} }
// Open the directory and file panels after location.
changeSplitterView(2);
} }
void VMainWindow::handleFindDialogTextChanged(const QString &p_text, uint /* p_options */) void VMainWindow::handleFindDialogTextChanged(const QString &p_text, uint /* p_options */)

View File

@ -36,7 +36,7 @@ class VMainWindow : public QMainWindow
public: public:
VMainWindow(QWidget *parent = 0); VMainWindow(QWidget *parent = 0);
const QVector<QPair<QString, QString> > &getPalette() const; const QVector<QPair<QString, QString> > &getPalette() const;
void locateFile(VFile *p_file) const; void locateFile(VFile *p_file);
private slots: private slots:
void importNoteFromFile(); void importNoteFromFile();
@ -112,6 +112,9 @@ private:
VAvatar *m_avatar; VAvatar *m_avatar;
VFindReplaceDialog *m_findReplaceDialog; VFindReplaceDialog *m_findReplaceDialog;
// Whether it is one panel or two panles.
bool m_onePanel;
// Actions // Actions
QAction *newRootDirAct; QAction *newRootDirAct;
QAction *newNoteAct; QAction *newNoteAct;