mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
refine interfaces
This commit is contained in:
parent
b09320e666
commit
4727d0aa98
@ -6,7 +6,7 @@ qss_file=v_material.qss
|
|||||||
mdhl_file=v_material.mdhl
|
mdhl_file=v_material.mdhl
|
||||||
css_file=v_material.css
|
css_file=v_material.css
|
||||||
codeblock_css_file=v_material_codeblock.css
|
codeblock_css_file=v_material_codeblock.css
|
||||||
vsersion=1
|
version=2
|
||||||
|
|
||||||
[phony]
|
[phony]
|
||||||
; Abstract color attributes.
|
; Abstract color attributes.
|
||||||
|
@ -10,11 +10,6 @@ QWidget
|
|||||||
{
|
{
|
||||||
color: @widget_fg;
|
color: @widget_fg;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget[NotebookPanel="true"] {
|
|
||||||
padding-left: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* End QWidget */
|
/* End QWidget */
|
||||||
|
|
||||||
/* QMainWindow */
|
/* QMainWindow */
|
||||||
|
@ -7,7 +7,7 @@ mdhl_file=v_moonlight.mdhl
|
|||||||
css_file=v_moonlight.css
|
css_file=v_moonlight.css
|
||||||
codeblock_css_file=v_moonlight_codeblock.css
|
codeblock_css_file=v_moonlight_codeblock.css
|
||||||
mermaid_css_file=v_moonlight_mermaid.css
|
mermaid_css_file=v_moonlight_mermaid.css
|
||||||
version=6
|
version=7
|
||||||
|
|
||||||
; This mapping will be used to translate colors when the content of HTML is copied
|
; This mapping will be used to translate colors when the content of HTML is copied
|
||||||
; without background. You could just specify the foreground colors mapping here.
|
; without background. You could just specify the foreground colors mapping here.
|
||||||
|
@ -6,10 +6,6 @@ QToolTip
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* QWidget */
|
/* QWidget */
|
||||||
QWidget[NotebookPanel="true"] {
|
|
||||||
padding-left: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget#FindReplaceTitleWidget {
|
QWidget#FindReplaceTitleWidget {
|
||||||
background: @title_bg;
|
background: @title_bg;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ mdhl_file=v_native.mdhl
|
|||||||
css_file=v_native.css
|
css_file=v_native.css
|
||||||
codeblock_css_file=v_native_codeblock.css
|
codeblock_css_file=v_native_codeblock.css
|
||||||
mermaid_css_file=v_native_mermaid.css
|
mermaid_css_file=v_native_mermaid.css
|
||||||
version=6
|
version=7
|
||||||
|
|
||||||
[phony]
|
[phony]
|
||||||
; Abstract color attributes.
|
; Abstract color attributes.
|
||||||
|
@ -4,10 +4,6 @@ QWidget
|
|||||||
color: @widget_fg;
|
color: @widget_fg;
|
||||||
font-family: "Hiragino Sans GB", "冬青黑体", "Microsoft YaHei", "微软雅黑", "Microsoft YaHei UI", "WenQuanYi Micro Hei", "文泉驿雅黑", "Dengxian", "等线体", "STXihei", "华文细黑", "Liberation Sans", "Droid Sans", "NSimSun", "新宋体", "SimSun", "宋体", "Helvetica", "sans-serif", "Tahoma", "Arial", "Verdana", "Geneva", "Georgia", "Times New Roman";
|
font-family: "Hiragino Sans GB", "冬青黑体", "Microsoft YaHei", "微软雅黑", "Microsoft YaHei UI", "WenQuanYi Micro Hei", "文泉驿雅黑", "Dengxian", "等线体", "STXihei", "华文细黑", "Liberation Sans", "Droid Sans", "NSimSun", "新宋体", "SimSun", "宋体", "Helvetica", "sans-serif", "Tahoma", "Arial", "Verdana", "Geneva", "Georgia", "Times New Roman";
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget[NotebookPanel="true"] {
|
|
||||||
padding-left: 3px;
|
|
||||||
}
|
|
||||||
/* End QWidget */
|
/* End QWidget */
|
||||||
|
|
||||||
/* QMenuBar */
|
/* QMenuBar */
|
||||||
|
@ -7,7 +7,7 @@ mdhl_file=v_pure.mdhl
|
|||||||
css_file=v_pure.css
|
css_file=v_pure.css
|
||||||
codeblock_css_file=v_pure_codeblock.css
|
codeblock_css_file=v_pure_codeblock.css
|
||||||
mermaid_css_file=v_pure_mermaid.css
|
mermaid_css_file=v_pure_mermaid.css
|
||||||
version=6
|
version=7
|
||||||
|
|
||||||
[phony]
|
[phony]
|
||||||
; Abstract color attributes.
|
; Abstract color attributes.
|
||||||
|
@ -6,10 +6,6 @@ QToolTip
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* QWidget */
|
/* QWidget */
|
||||||
QWidget[NotebookPanel="true"] {
|
|
||||||
padding-left: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget#FindReplaceTitleWidget {
|
QWidget#FindReplaceTitleWidget {
|
||||||
background: @title_bg;
|
background: @title_bg;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@ VCart::VCart(QWidget *p_parent)
|
|||||||
{
|
{
|
||||||
setupUI();
|
setupUI();
|
||||||
|
|
||||||
|
updateNumberLabel();
|
||||||
|
|
||||||
initActions();
|
initActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,6 +42,7 @@ void VCart::setupUI()
|
|||||||
MessageBoxType::Danger);
|
MessageBoxType::Danger);
|
||||||
if (ret == QMessageBox::Ok) {
|
if (ret == QMessageBox::Ok) {
|
||||||
m_itemList->clear();
|
m_itemList->clear();
|
||||||
|
updateNumberLabel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -158,14 +161,7 @@ void VCart::addItem(const QString &p_path)
|
|||||||
item->setData(Qt::UserRole, p_path);
|
item->setData(Qt::UserRole, p_path);
|
||||||
|
|
||||||
m_itemList->addItem(item);
|
m_itemList->addItem(item);
|
||||||
|
updateNumberLabel();
|
||||||
int cnt = m_itemList->count();
|
|
||||||
if (cnt > 0) {
|
|
||||||
m_numLabel->setText(tr("%1 %2").arg(cnt)
|
|
||||||
.arg(cnt > 1 ? tr("Items") : tr("Item")));
|
|
||||||
} else {
|
|
||||||
m_numLabel->setText("");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCart::deleteSelectedItems()
|
void VCart::deleteSelectedItems()
|
||||||
@ -263,3 +259,10 @@ void VCart::sortItems()
|
|||||||
VListWidget::sortListWidget(m_itemList, sortedIdx);
|
VListWidget::sortListWidget(m_itemList, sortedIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VCart::updateNumberLabel() const
|
||||||
|
{
|
||||||
|
int cnt = m_itemList->count();
|
||||||
|
m_numLabel->setText(tr("%1 %2").arg(cnt)
|
||||||
|
.arg(cnt > 1 ? tr("Items") : tr("Item")));
|
||||||
|
}
|
||||||
|
@ -51,6 +51,8 @@ private:
|
|||||||
|
|
||||||
QString getFilePath(const QListWidgetItem *p_item) const;
|
QString getFilePath(const QListWidgetItem *p_item) const;
|
||||||
|
|
||||||
|
void updateNumberLabel() const;
|
||||||
|
|
||||||
QPushButton *m_clearBtn;
|
QPushButton *m_clearBtn;
|
||||||
QLabel *m_numLabel;
|
QLabel *m_numLabel;
|
||||||
QListWidget *m_itemList;
|
QListWidget *m_itemList;
|
||||||
|
@ -56,10 +56,24 @@ VFileList::VFileList(QWidget *parent)
|
|||||||
fileList->setFocus();
|
fileList->setFocus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
updateNumberLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VFileList::setupUI()
|
void VFileList::setupUI()
|
||||||
{
|
{
|
||||||
|
QLabel *titleLabel = new QLabel(tr("Notes"), this);
|
||||||
|
titleLabel->setProperty("TitleLabel", true);
|
||||||
|
|
||||||
|
m_numLabel = new QLabel(this);
|
||||||
|
|
||||||
|
QHBoxLayout *titleLayout = new QHBoxLayout();
|
||||||
|
titleLayout->addWidget(titleLabel);
|
||||||
|
titleLayout->addStretch();
|
||||||
|
titleLayout->addWidget(m_numLabel);
|
||||||
|
|
||||||
|
titleLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
fileList = new VListWidget(this);
|
fileList = new VListWidget(this);
|
||||||
fileList->setContextMenuPolicy(Qt::CustomContextMenu);
|
fileList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
fileList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
fileList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
@ -67,6 +81,7 @@ void VFileList::setupUI()
|
|||||||
fileList->setAttribute(Qt::WA_MacShowFocusRect, false);
|
fileList->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
|
mainLayout->addLayout(titleLayout);
|
||||||
mainLayout->addWidget(fileList);
|
mainLayout->addWidget(fileList);
|
||||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
@ -198,6 +213,7 @@ void VFileList::setDirectory(VDirectory *p_directory)
|
|||||||
if (m_directory == p_directory) {
|
if (m_directory == p_directory) {
|
||||||
if (!m_directory) {
|
if (!m_directory) {
|
||||||
fileList->clearAll();
|
fileList->clearAll();
|
||||||
|
updateNumberLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -206,6 +222,7 @@ void VFileList::setDirectory(VDirectory *p_directory)
|
|||||||
m_directory = p_directory;
|
m_directory = p_directory;
|
||||||
if (!m_directory) {
|
if (!m_directory) {
|
||||||
fileList->clearAll();
|
fileList->clearAll();
|
||||||
|
updateNumberLabel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,6 +241,8 @@ void VFileList::updateFileList()
|
|||||||
VNoteFile *file = files[i];
|
VNoteFile *file = files[i];
|
||||||
insertFileListItem(file);
|
insertFileListItem(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateNumberLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VFileList::fileInfo()
|
void VFileList::fileInfo()
|
||||||
@ -1188,3 +1207,10 @@ void VFileList::handleOpenWithActionTriggered()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VFileList::updateNumberLabel() const
|
||||||
|
{
|
||||||
|
int cnt = fileList->count();
|
||||||
|
m_numLabel->setText(tr("%1 %2").arg(cnt)
|
||||||
|
.arg(cnt > 1 ? tr("Items") : tr("Item")));
|
||||||
|
}
|
||||||
|
@ -166,8 +166,14 @@ private:
|
|||||||
|
|
||||||
void activateItem(QListWidgetItem *p_item, bool p_restoreFocus = false);
|
void activateItem(QListWidgetItem *p_item, bool p_restoreFocus = false);
|
||||||
|
|
||||||
|
void updateNumberLabel() const;
|
||||||
|
|
||||||
VEditArea *editArea;
|
VEditArea *editArea;
|
||||||
|
|
||||||
VListWidget *fileList;
|
VListWidget *fileList;
|
||||||
|
|
||||||
|
QLabel *m_numLabel;
|
||||||
|
|
||||||
QPointer<VDirectory> m_directory;
|
QPointer<VDirectory> m_directory;
|
||||||
|
|
||||||
// Magic number for clipboard operations.
|
// Magic number for clipboard operations.
|
||||||
|
@ -276,22 +276,18 @@ void VMainWindow::setupUI()
|
|||||||
QWidget *VMainWindow::setupDirectoryPanel()
|
QWidget *VMainWindow::setupDirectoryPanel()
|
||||||
{
|
{
|
||||||
// Notebook selector.
|
// Notebook selector.
|
||||||
notebookLabel = new QLabel(tr("Notebooks"));
|
QLabel *notebookLabel = new QLabel(tr("Notebooks"));
|
||||||
notebookLabel->setProperty("TitleLabel", true);
|
notebookLabel->setProperty("TitleLabel", true);
|
||||||
notebookLabel->setProperty("NotebookPanel", true);
|
|
||||||
|
|
||||||
notebookSelector = new VNotebookSelector();
|
notebookSelector = new VNotebookSelector();
|
||||||
notebookSelector->setObjectName("NotebookSelector");
|
notebookSelector->setObjectName("NotebookSelector");
|
||||||
notebookSelector->setProperty("NotebookPanel", true);
|
|
||||||
notebookSelector->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
|
notebookSelector->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
|
||||||
|
|
||||||
// Navigation panel.
|
// Navigation panel.
|
||||||
directoryLabel = new QLabel(tr("Folders"));
|
QLabel *directoryLabel = new QLabel(tr("Folders"));
|
||||||
directoryLabel->setProperty("TitleLabel", true);
|
directoryLabel->setProperty("TitleLabel", true);
|
||||||
directoryLabel->setProperty("NotebookPanel", true);
|
|
||||||
|
|
||||||
directoryTree = new VDirectoryTree;
|
directoryTree = new VDirectoryTree;
|
||||||
directoryTree->setProperty("NotebookPanel", true);
|
|
||||||
|
|
||||||
QVBoxLayout *naviLayout = new QVBoxLayout;
|
QVBoxLayout *naviLayout = new QVBoxLayout;
|
||||||
naviLayout->addWidget(directoryLabel);
|
naviLayout->addWidget(directoryLabel);
|
||||||
@ -318,10 +314,9 @@ QWidget *VMainWindow::setupDirectoryPanel()
|
|||||||
nbLayout->addWidget(notebookLabel);
|
nbLayout->addWidget(notebookLabel);
|
||||||
nbLayout->addWidget(notebookSelector);
|
nbLayout->addWidget(notebookSelector);
|
||||||
nbLayout->addWidget(m_naviSplitter);
|
nbLayout->addWidget(m_naviSplitter);
|
||||||
nbLayout->setContentsMargins(0, 0, 0, 0);
|
nbLayout->setContentsMargins(3, 0, 0, 0);
|
||||||
nbLayout->setSpacing(0);
|
nbLayout->setSpacing(0);
|
||||||
QWidget *nbContainer = new QWidget();
|
QWidget *nbContainer = new QWidget();
|
||||||
nbContainer->setObjectName("NotebookPanel");
|
|
||||||
nbContainer->setLayout(nbLayout);
|
nbContainer->setLayout(nbLayout);
|
||||||
nbContainer->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
|
nbContainer->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
@ -315,8 +315,6 @@ private:
|
|||||||
|
|
||||||
VCaptain *m_captain;
|
VCaptain *m_captain;
|
||||||
|
|
||||||
QLabel *notebookLabel;
|
|
||||||
QLabel *directoryLabel;
|
|
||||||
VNotebookSelector *notebookSelector;
|
VNotebookSelector *notebookSelector;
|
||||||
VFileList *m_fileList;
|
VFileList *m_fileList;
|
||||||
VDirectoryTree *directoryTree;
|
VDirectoryTree *directoryTree;
|
||||||
|
@ -39,6 +39,8 @@ VSnippetList::VSnippetList(QWidget *p_parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateContent();
|
updateContent();
|
||||||
|
|
||||||
|
updateNumberLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VSnippetList::setupUI()
|
void VSnippetList::setupUI()
|
||||||
@ -394,13 +396,12 @@ void VSnippetList::updateContent()
|
|||||||
|
|
||||||
int cnt = m_snippetList->count();
|
int cnt = m_snippetList->count();
|
||||||
if (cnt > 0) {
|
if (cnt > 0) {
|
||||||
m_numLabel->setText(tr("%1 %2").arg(cnt)
|
|
||||||
.arg(cnt > 1 ? tr("Snippets") : tr("Snippet")));
|
|
||||||
m_snippetList->setFocus();
|
m_snippetList->setFocus();
|
||||||
} else {
|
} else {
|
||||||
m_numLabel->setText("");
|
|
||||||
m_addBtn->setFocus();
|
m_addBtn->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateNumberLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VSnippetList::addSnippet(const VSnippet &p_snippet, QString *p_errMsg)
|
bool VSnippetList::addSnippet(const VSnippet &p_snippet, QString *p_errMsg)
|
||||||
@ -623,3 +624,10 @@ void VSnippetList::focusInEvent(QFocusEvent *p_event)
|
|||||||
m_snippetList->setFocus();
|
m_snippetList->setFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VSnippetList::updateNumberLabel() const
|
||||||
|
{
|
||||||
|
int cnt = m_snippetList->count();
|
||||||
|
m_numLabel->setText(tr("%1 %2").arg(cnt)
|
||||||
|
.arg(cnt > 1 ? tr("Items") : tr("Item")));
|
||||||
|
}
|
||||||
|
@ -87,6 +87,8 @@ private:
|
|||||||
|
|
||||||
bool deleteSnippetFile(const VSnippet &p_snippet, QString *p_errMsg = nullptr);
|
bool deleteSnippetFile(const VSnippet &p_snippet, QString *p_errMsg = nullptr);
|
||||||
|
|
||||||
|
void updateNumberLabel() const;
|
||||||
|
|
||||||
QPushButton *m_addBtn;
|
QPushButton *m_addBtn;
|
||||||
QPushButton *m_locateBtn;
|
QPushButton *m_locateBtn;
|
||||||
QLabel *m_numLabel;
|
QLabel *m_numLabel;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user