mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
split setupUI() in VMainWindow
Signed-off-by: Le Tan <tamlokveer@gmail.com>
This commit is contained in:
parent
f37d1f57a8
commit
7c69f80f17
@ -38,41 +38,7 @@ VMainWindow::~VMainWindow()
|
|||||||
|
|
||||||
void VMainWindow::setupUI()
|
void VMainWindow::setupUI()
|
||||||
{
|
{
|
||||||
// Notebook directory browser tree
|
QWidget *directoryPanel = setupDirectoryPanel();
|
||||||
notebookLabel = new QLabel(tr("Notebook"));
|
|
||||||
directoryLabel = new QLabel(tr("Directory"));
|
|
||||||
|
|
||||||
newNotebookBtn = new QPushButton(QIcon(":/resources/icons/create_notebook.svg"), "");
|
|
||||||
newNotebookBtn->setToolTip(tr("Create a new notebook"));
|
|
||||||
newNotebookBtn->setProperty("OnMainWindow", true);
|
|
||||||
deleteNotebookBtn = new QPushButton(QIcon(":/resources/icons/delete_notebook.svg"), "");
|
|
||||||
deleteNotebookBtn->setToolTip(tr("Delete current notebook"));
|
|
||||||
deleteNotebookBtn->setProperty("OnMainWindow", true);
|
|
||||||
notebookInfoBtn = new QPushButton(QIcon(":/resources/icons/notebook_info.svg"), "");
|
|
||||||
notebookInfoBtn->setToolTip(tr("View and edit current notebook's information"));
|
|
||||||
notebookInfoBtn->setProperty("OnMainWindow", true);
|
|
||||||
|
|
||||||
notebookComboBox = new QComboBox();
|
|
||||||
notebookComboBox->setProperty("OnMainWindow", true);
|
|
||||||
notebookComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
|
||||||
directoryTree = new VDirectoryTree(vnote);
|
|
||||||
|
|
||||||
QHBoxLayout *nbBtnLayout = new QHBoxLayout;
|
|
||||||
nbBtnLayout->addWidget(notebookLabel);
|
|
||||||
nbBtnLayout->addStretch();
|
|
||||||
nbBtnLayout->addWidget(newNotebookBtn);
|
|
||||||
nbBtnLayout->addWidget(deleteNotebookBtn);
|
|
||||||
nbBtnLayout->addWidget(notebookInfoBtn);
|
|
||||||
nbBtnLayout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
QVBoxLayout *nbLayout = new QVBoxLayout;
|
|
||||||
nbLayout->addLayout(nbBtnLayout);
|
|
||||||
nbLayout->addWidget(notebookComboBox);
|
|
||||||
nbLayout->addWidget(directoryLabel);
|
|
||||||
nbLayout->addWidget(directoryTree);
|
|
||||||
nbLayout->setContentsMargins(5, 0, 0, 0);
|
|
||||||
QWidget *nbContainer = new QWidget();
|
|
||||||
nbContainer->setLayout(nbLayout);
|
|
||||||
nbContainer->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
|
|
||||||
|
|
||||||
fileList = new VFileList(vnote);
|
fileList = new VFileList(vnote);
|
||||||
fileList->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
|
fileList->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
|
||||||
@ -83,7 +49,7 @@ void VMainWindow::setupUI()
|
|||||||
|
|
||||||
// Main Splitter
|
// Main Splitter
|
||||||
mainSplitter = new QSplitter();
|
mainSplitter = new QSplitter();
|
||||||
mainSplitter->addWidget(nbContainer);
|
mainSplitter->addWidget(directoryPanel);
|
||||||
mainSplitter->addWidget(fileList);
|
mainSplitter->addWidget(fileList);
|
||||||
mainSplitter->addWidget(editArea);
|
mainSplitter->addWidget(editArea);
|
||||||
mainSplitter->setStretchFactor(0, 0);
|
mainSplitter->setStretchFactor(0, 0);
|
||||||
@ -144,6 +110,46 @@ void VMainWindow::setupUI()
|
|||||||
statusBar();
|
statusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget *VMainWindow::setupDirectoryPanel()
|
||||||
|
{
|
||||||
|
notebookLabel = new QLabel(tr("Notebook"));
|
||||||
|
directoryLabel = new QLabel(tr("Directory"));
|
||||||
|
|
||||||
|
newNotebookBtn = new QPushButton(QIcon(":/resources/icons/create_notebook.svg"), "");
|
||||||
|
newNotebookBtn->setToolTip(tr("Create a new notebook"));
|
||||||
|
newNotebookBtn->setProperty("OnMainWindow", true);
|
||||||
|
deleteNotebookBtn = new QPushButton(QIcon(":/resources/icons/delete_notebook.svg"), "");
|
||||||
|
deleteNotebookBtn->setToolTip(tr("Delete current notebook"));
|
||||||
|
deleteNotebookBtn->setProperty("OnMainWindow", true);
|
||||||
|
notebookInfoBtn = new QPushButton(QIcon(":/resources/icons/notebook_info.svg"), "");
|
||||||
|
notebookInfoBtn->setToolTip(tr("View and edit current notebook's information"));
|
||||||
|
notebookInfoBtn->setProperty("OnMainWindow", true);
|
||||||
|
|
||||||
|
notebookComboBox = new QComboBox();
|
||||||
|
notebookComboBox->setProperty("OnMainWindow", true);
|
||||||
|
notebookComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
|
directoryTree = new VDirectoryTree(vnote);
|
||||||
|
|
||||||
|
QHBoxLayout *nbBtnLayout = new QHBoxLayout;
|
||||||
|
nbBtnLayout->addWidget(notebookLabel);
|
||||||
|
nbBtnLayout->addStretch();
|
||||||
|
nbBtnLayout->addWidget(newNotebookBtn);
|
||||||
|
nbBtnLayout->addWidget(deleteNotebookBtn);
|
||||||
|
nbBtnLayout->addWidget(notebookInfoBtn);
|
||||||
|
nbBtnLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
QVBoxLayout *nbLayout = new QVBoxLayout;
|
||||||
|
nbLayout->addLayout(nbBtnLayout);
|
||||||
|
nbLayout->addWidget(notebookComboBox);
|
||||||
|
nbLayout->addWidget(directoryLabel);
|
||||||
|
nbLayout->addWidget(directoryTree);
|
||||||
|
nbLayout->setContentsMargins(5, 0, 0, 0);
|
||||||
|
QWidget *nbContainer = new QWidget();
|
||||||
|
nbContainer->setLayout(nbLayout);
|
||||||
|
nbContainer->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
return nbContainer;
|
||||||
|
}
|
||||||
|
|
||||||
void VMainWindow::initActions()
|
void VMainWindow::initActions()
|
||||||
{
|
{
|
||||||
newRootDirAct = new QAction(QIcon(":/resources/icons/create_rootdir_tb.svg"),
|
newRootDirAct = new QAction(QIcon(":/resources/icons/create_rootdir_tb.svg"),
|
||||||
|
@ -65,6 +65,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void setupUI();
|
void setupUI();
|
||||||
|
QWidget *setupDirectoryPanel();
|
||||||
void initActions();
|
void initActions();
|
||||||
void initToolBar();
|
void initToolBar();
|
||||||
void initMenuBar();
|
void initMenuBar();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user