mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
remove buttons in directory tree
Signed-off-by: Le Tan <tamlokveer@gmail.com>
This commit is contained in:
parent
3d6778e1fe
commit
550a3707a5
14
src/resources/icons/create_rootdir_tb.svg
Normal file
14
src/resources/icons/create_rootdir_tb.svg
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
||||||
|
<g>
|
||||||
|
<path d="M430.1,192H81.9c-17.7,0-18.6,9.2-17.6,20.5l13,183c0.9,11.2,3.5,20.5,21.1,20.5h316.2c18,0,20.1-9.2,21.1-20.5l12.1-185.3
|
||||||
|
C448.7,199,447.8,192,430.1,192z"/>
|
||||||
|
<g>
|
||||||
|
<path d="M426.2,143.3c-0.5-12.4-4.5-15.3-15.1-15.3c0,0-121.4,0-143.2,0c-21.8,0-24.4,0.3-40.9-17.4C213.3,95.8,218.7,96,190.4,96
|
||||||
|
c-22.6,0-75.3,0-75.3,0c-17.4,0-23.6-1.5-25.2,16.6c-1.5,16.7-5,57.2-5.5,63.4h343.4L426.2,143.3z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 914 B |
@ -23,7 +23,8 @@ VDirectoryTree::VDirectoryTree(VNote *vnote, QWidget *parent)
|
|||||||
|
|
||||||
void VDirectoryTree::initActions()
|
void VDirectoryTree::initActions()
|
||||||
{
|
{
|
||||||
newRootDirAct = new QAction(tr("New &root directory"), this);
|
newRootDirAct = new QAction(QIcon(":/resources/icons/create_rootdir.svg"),
|
||||||
|
tr("New &root directory"), this);
|
||||||
newRootDirAct->setStatusTip(tr("Create a new root directory in current notebook"));
|
newRootDirAct->setStatusTip(tr("Create a new root directory in current notebook"));
|
||||||
connect(newRootDirAct, &QAction::triggered,
|
connect(newRootDirAct, &QAction::triggered,
|
||||||
this, &VDirectoryTree::newRootDirectory);
|
this, &VDirectoryTree::newRootDirectory);
|
||||||
@ -38,10 +39,17 @@ void VDirectoryTree::initActions()
|
|||||||
connect(newSubDirAct, &QAction::triggered,
|
connect(newSubDirAct, &QAction::triggered,
|
||||||
this, &VDirectoryTree::newSubDirectory);
|
this, &VDirectoryTree::newSubDirectory);
|
||||||
|
|
||||||
deleteDirAct = new QAction(tr("&Delete"), this);
|
deleteDirAct = new QAction(QIcon(":/resources/icons/delete_dir.svg"),
|
||||||
|
tr("&Delete"), this);
|
||||||
deleteDirAct->setStatusTip(tr("Delete selected directory"));
|
deleteDirAct->setStatusTip(tr("Delete selected directory"));
|
||||||
connect(deleteDirAct, &QAction::triggered,
|
connect(deleteDirAct, &QAction::triggered,
|
||||||
this, &VDirectoryTree::deleteDirectory);
|
this, &VDirectoryTree::deleteDirectory);
|
||||||
|
|
||||||
|
dirInfoAct = new QAction(QIcon(":/resources/icons/dir_info.svg"),
|
||||||
|
tr("&Info"), this);
|
||||||
|
dirInfoAct->setStatusTip(tr("View and edit current directory's information"));
|
||||||
|
connect(dirInfoAct, &QAction::triggered,
|
||||||
|
this, &VDirectoryTree::editDirectoryInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VDirectoryTree::setNotebook(const QString& notebookName)
|
void VDirectoryTree::setNotebook(const QString& notebookName)
|
||||||
@ -263,6 +271,7 @@ void VDirectoryTree::contextMenuRequested(QPoint pos)
|
|||||||
menu.addAction(newSubDirAct);
|
menu.addAction(newSubDirAct);
|
||||||
}
|
}
|
||||||
menu.addAction(deleteDirAct);
|
menu.addAction(deleteDirAct);
|
||||||
|
menu.addAction(dirInfoAct);
|
||||||
}
|
}
|
||||||
menu.exec(mapToGlobal(pos));
|
menu.exec(mapToGlobal(pos));
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,7 @@ private:
|
|||||||
QAction *newSiblingDirAct;
|
QAction *newSiblingDirAct;
|
||||||
QAction *newSubDirAct;
|
QAction *newSubDirAct;
|
||||||
QAction *deleteDirAct;
|
QAction *deleteDirAct;
|
||||||
|
QAction *dirInfoAct;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VDIRECTORYTREE_H
|
#endif // VDIRECTORYTREE_H
|
||||||
|
@ -46,13 +46,6 @@ void VMainWindow::setupUI()
|
|||||||
notebookInfoBtn = new QPushButton(QIcon(":/resources/icons/notebook_info.svg"), "");
|
notebookInfoBtn = new QPushButton(QIcon(":/resources/icons/notebook_info.svg"), "");
|
||||||
notebookInfoBtn->setToolTip(tr("View and edit current notebook's information"));
|
notebookInfoBtn->setToolTip(tr("View and edit current notebook's information"));
|
||||||
|
|
||||||
newRootDirBtn = new QPushButton(QIcon(":/resources/icons/create_rootdir.svg"), "");
|
|
||||||
newRootDirBtn->setToolTip(tr("Create a new root directory"));
|
|
||||||
deleteDirBtn = new QPushButton(QIcon(":/resources/icons/delete_dir.svg"), "");
|
|
||||||
deleteDirBtn->setToolTip(tr("Delete current directory"));
|
|
||||||
dirInfoBtn = new QPushButton(QIcon(":/resources/icons/dir_info.svg"), "");
|
|
||||||
dirInfoBtn->setToolTip(tr("View and edit current directory's information"));
|
|
||||||
|
|
||||||
notebookComboBox = new QComboBox();
|
notebookComboBox = new QComboBox();
|
||||||
notebookComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
notebookComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
directoryTree = new VDirectoryTree(vnote);
|
directoryTree = new VDirectoryTree(vnote);
|
||||||
@ -66,9 +59,6 @@ void VMainWindow::setupUI()
|
|||||||
QHBoxLayout *dirBtnLayout = new QHBoxLayout;
|
QHBoxLayout *dirBtnLayout = new QHBoxLayout;
|
||||||
dirBtnLayout->addWidget(directoryLabel);
|
dirBtnLayout->addWidget(directoryLabel);
|
||||||
dirBtnLayout->addStretch();
|
dirBtnLayout->addStretch();
|
||||||
dirBtnLayout->addWidget(newRootDirBtn);
|
|
||||||
dirBtnLayout->addWidget(deleteDirBtn);
|
|
||||||
dirBtnLayout->addWidget(dirInfoBtn);
|
|
||||||
QVBoxLayout *nbLayout = new QVBoxLayout;
|
QVBoxLayout *nbLayout = new QVBoxLayout;
|
||||||
nbLayout->addLayout(nbBtnLayout);
|
nbLayout->addLayout(nbBtnLayout);
|
||||||
nbLayout->addWidget(notebookComboBox);
|
nbLayout->addWidget(notebookComboBox);
|
||||||
@ -137,12 +127,6 @@ void VMainWindow::setupUI()
|
|||||||
directoryTree, &VDirectoryTree::setNotebook);
|
directoryTree, &VDirectoryTree::setNotebook);
|
||||||
connect(vnote, &VNote::notebooksRenamed,
|
connect(vnote, &VNote::notebooksRenamed,
|
||||||
directoryTree, &VDirectoryTree::handleNotebookRenamed);
|
directoryTree, &VDirectoryTree::handleNotebookRenamed);
|
||||||
connect(newRootDirBtn, &QPushButton::clicked,
|
|
||||||
directoryTree, &VDirectoryTree::newRootDirectory);
|
|
||||||
connect(deleteDirBtn, &QPushButton::clicked,
|
|
||||||
directoryTree, &VDirectoryTree::deleteDirectory);
|
|
||||||
connect(dirInfoBtn, &QPushButton::clicked,
|
|
||||||
directoryTree, &VDirectoryTree::editDirectoryInfo);
|
|
||||||
|
|
||||||
setCentralWidget(mainSplitter);
|
setCentralWidget(mainSplitter);
|
||||||
// Create and show the status bar
|
// Create and show the status bar
|
||||||
@ -151,6 +135,11 @@ void VMainWindow::setupUI()
|
|||||||
|
|
||||||
void VMainWindow::initActions()
|
void VMainWindow::initActions()
|
||||||
{
|
{
|
||||||
|
newRootDirAct = new QAction(QIcon(":/resources/icons/create_rootdir_tb.svg"),
|
||||||
|
tr("&New rood directory"), this);
|
||||||
|
newRootDirAct->setStatusTip(tr("Create a new root directory"));
|
||||||
|
connect(newRootDirAct, &QAction::triggered,
|
||||||
|
directoryTree, &VDirectoryTree::newRootDirectory);
|
||||||
newNoteAct = new QAction(QIcon(":/resources/icons/create_note_tb.svg"),
|
newNoteAct = new QAction(QIcon(":/resources/icons/create_note_tb.svg"),
|
||||||
tr("&New note"), this);
|
tr("&New note"), this);
|
||||||
newNoteAct->setStatusTip(tr("Create a new note"));
|
newNoteAct->setStatusTip(tr("Create a new note"));
|
||||||
@ -263,12 +252,14 @@ void VMainWindow::initActions()
|
|||||||
void VMainWindow::initToolBar()
|
void VMainWindow::initToolBar()
|
||||||
{
|
{
|
||||||
QToolBar *fileToolBar = addToolBar(tr("Note"));
|
QToolBar *fileToolBar = addToolBar(tr("Note"));
|
||||||
|
fileToolBar->addAction(newRootDirAct);
|
||||||
fileToolBar->addAction(newNoteAct);
|
fileToolBar->addAction(newNoteAct);
|
||||||
fileToolBar->addAction(editNoteAct);
|
fileToolBar->addAction(editNoteAct);
|
||||||
fileToolBar->addAction(saveExitAct);
|
fileToolBar->addAction(saveExitAct);
|
||||||
fileToolBar->addAction(discardExitAct);
|
fileToolBar->addAction(discardExitAct);
|
||||||
fileToolBar->addAction(saveNoteAct);
|
fileToolBar->addAction(saveNoteAct);
|
||||||
|
|
||||||
|
newRootDirAct->setEnabled(false);
|
||||||
newNoteAct->setEnabled(false);
|
newNoteAct->setEnabled(false);
|
||||||
editNoteAct->setEnabled(false);
|
editNoteAct->setEnabled(false);
|
||||||
saveExitAct->setVisible(false);
|
saveExitAct->setVisible(false);
|
||||||
@ -432,6 +423,9 @@ void VMainWindow::setCurNotebookIndex(int index)
|
|||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
vconfig.setCurNotebookIndex(index);
|
vconfig.setCurNotebookIndex(index);
|
||||||
notebook = vnote->getNotebooks()[index].getName();
|
notebook = vnote->getNotebooks()[index].getName();
|
||||||
|
newRootDirAct->setEnabled(true);
|
||||||
|
} else {
|
||||||
|
newRootDirAct->setEnabled(false);
|
||||||
}
|
}
|
||||||
emit curNotebookChanged(notebook);
|
emit curNotebookChanged(notebook);
|
||||||
}
|
}
|
||||||
|
@ -76,9 +76,6 @@ private:
|
|||||||
QPushButton *newNotebookBtn;
|
QPushButton *newNotebookBtn;
|
||||||
QPushButton *deleteNotebookBtn;
|
QPushButton *deleteNotebookBtn;
|
||||||
QPushButton *notebookInfoBtn;
|
QPushButton *notebookInfoBtn;
|
||||||
QPushButton *newRootDirBtn;
|
|
||||||
QPushButton *deleteDirBtn;
|
|
||||||
QPushButton *dirInfoBtn;
|
|
||||||
VFileList *fileList;
|
VFileList *fileList;
|
||||||
VDirectoryTree *directoryTree;
|
VDirectoryTree *directoryTree;
|
||||||
QSplitter *mainSplitter;
|
QSplitter *mainSplitter;
|
||||||
@ -87,6 +84,7 @@ private:
|
|||||||
VOutline *outline;
|
VOutline *outline;
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
QAction *newRootDirAct;
|
||||||
QAction *newNoteAct;
|
QAction *newNoteAct;
|
||||||
QAction *editNoteAct;
|
QAction *editNoteAct;
|
||||||
QAction *saveNoteAct;
|
QAction *saveNoteAct;
|
||||||
|
@ -58,5 +58,6 @@
|
|||||||
<file>resources/icons/remove_split.svg</file>
|
<file>resources/icons/remove_split.svg</file>
|
||||||
<file>resources/icons/corner_tablist.svg</file>
|
<file>resources/icons/corner_tablist.svg</file>
|
||||||
<file>resources/icons/outline.svg</file>
|
<file>resources/icons/outline.svg</file>
|
||||||
|
<file>resources/icons/create_rootdir_tb.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user