add Close All Tabs context menu

This commit is contained in:
Le Tan 2018-01-22 20:29:14 +08:00
parent b45f1d9518
commit 14d0f1700c
4 changed files with 25 additions and 2 deletions

View File

@ -1,5 +1,7 @@
# VNote Themes
VNote supports themes. A theme is a folder in the subfolder `themes` in VNote's configuration folder. The best way to make a custom theme is to download the default themes [here](https://github.com/tamlok/vnote/tree/master/src/resources/themes), rename related files, put them in the theme folder, and tune it to your taste.
VNote supports themes. A theme is a folder in the subfolder `themes` in VNote's configuration folder. The best way to make a custom theme is to copy one of the default themes, rename related files, put them in the theme folder, and tune it to your taste.
Please do not modify the default themes directly, or you may lose your changes.
A restart is needed to detect or apply a new theme.

View File

@ -1,5 +1,7 @@
# VNote主题
VNote支持主题。一个主题对应于VNote的配置文件夹的子文件夹`themes`下的一个文件夹。自定义主题最好的方法是下载默认的[主题](https://github.com/tamlok/vnote/tree/master/src/resources/themes),重命名相关文件,将该文件夹放到主题文件夹下,并逐步修改调试。
VNote支持主题。一个主题对应于VNote的配置文件夹的子文件夹`themes`下的一个文件夹。自定义主题最好的方法是复制一个默认的主题,重命名相关文件,将该文件夹放到主题文件夹下,并逐步修改调试。
请不要直接修改默认的主题,否则您的更改可能会丢失。
VNote需要重新启动以检测新的主题或应用一个主题。

View File

@ -112,6 +112,19 @@ void VEditWindow::initTabActions()
}
});
m_closeAllAct = new QAction(tr("Close All Tabs"), this);
m_closeAllAct->setToolTip(tr("Close all the note tabs"));
connect(m_closeAllAct, &QAction::triggered,
this, [this](){
for (int i = 0; i < this->count();) {
this->setCurrentIndex(i);
this->updateTabStatus(i);
if (!this->closeTab(i)) {
++i;
}
}
});
m_closeRightAct = new QAction(tr("Close Tabs To The Right"), this);
m_closeRightAct->setToolTip(tr("Close all the note tabs to the right of current tab"));
connect(m_closeRightAct, &QAction::triggered,
@ -710,12 +723,15 @@ void VEditWindow::tabbarContextMenuRequested(QPoint p_pos)
if (count() > 1) {
m_closeOthersAct->setData(tab);
menu.addAction(m_closeOthersAct);
if (tab < count() - 1) {
m_closeRightAct->setData(tab);
menu.addAction(m_closeRightAct);
}
}
menu.addAction(m_closeAllAct);
if (!menu.actions().isEmpty()) {
menu.exec(bar->mapToGlobal(p_pos));
}

View File

@ -202,6 +202,9 @@ private:
// Close tabs to the right in tab menu.
QAction *m_closeRightAct;
// Close all tabs.
QAction *m_closeAllAct;
// View and edit info about this note.
QAction *m_noteInfoAct;