From 590f222de4abdf2aae4d2d8de6f9af25996a713e Mon Sep 17 00:00:00 2001 From: Saturneric Date: Mon, 6 Dec 2021 02:51:59 +0800 Subject: Improve UI 1. Support Key List Tab 2. File Hash Calculate 3. File Rename 4. Fix known bugs 5. Fix known ci issues. --- src/ui/widgets/TextEdit.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/ui/widgets/TextEdit.cpp') diff --git a/src/ui/widgets/TextEdit.cpp b/src/ui/widgets/TextEdit.cpp index 8d4ea4a0..ec6c6c7a 100644 --- a/src/ui/widgets/TextEdit.cpp +++ b/src/ui/widgets/TextEdit.cpp @@ -51,7 +51,8 @@ void TextEdit::slotNewTab() { QString header = _("untitled") + QString::number(++countPage) + ".txt"; auto* page = new EditorPage(); - tabWidget->addTab(page, header); + auto index = tabWidget->addTab(page, header); + tabWidget->setTabIcon(index, QIcon(":file.png")); tabWidget->setCurrentIndex(tabWidget->count() - 1); page->getTextPage()->setFocus(); connect(page->getTextPage()->document(), SIGNAL(modificationChanged(bool)), @@ -66,10 +67,12 @@ void TextEdit::slotNewHelpTab(const QString& title, const QString& path) const { void TextEdit::slotNewFileTab() const { auto* page = new FilePage(qobject_cast(parent())); - tabWidget->addTab(page, "[Browser]"); + auto index = tabWidget->addTab(page, QString()); + tabWidget->setTabIcon(index, QIcon(":file-browser.png")); tabWidget->setCurrentIndex(tabWidget->count() - 1); - connect(page, SIGNAL(pathChanged(const QString&)), this, - SLOT(slotFilePagePathChanged(const QString&))); + connect(page, &FilePage::pathChanged, this, + &TextEdit::slotFilePagePathChanged); + page->slotGoPath(); } void TextEdit::slotOpenFile(QString& path) { @@ -580,7 +583,6 @@ void TextEdit::slotFilePagePathChanged(const QString& path) const { } else { mPath = tPath; } - mPath.prepend("[Browser] "); tabWidget->setTabText(index, mPath); } -- cgit v1.2.3