mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 05:49:53 +08:00
add abck tab icon
This commit is contained in:
parent
08c597513c
commit
2a91577521
4
.github/workflows/ci-linux.yml
vendored
4
.github/workflows/ci-linux.yml
vendored
@ -45,12 +45,12 @@ jobs:
|
||||
uses: actions/cache@v1 # not v2!
|
||||
with:
|
||||
path: ../Qt
|
||||
key: ${{ runner.os }}-QtCache-5.12-1
|
||||
key: ${{ runner.os }}-QtCache-5.15
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
with:
|
||||
version: 5.12.12
|
||||
version: 5.15.2
|
||||
target: desktop
|
||||
modules: qtwebengine
|
||||
tools: tools_openssl_x64,1.1.1-4,qt.tools.openssl.gcc_64
|
||||
|
@ -41,11 +41,17 @@
|
||||
|
||||
using namespace vnotex;
|
||||
|
||||
QIcon ViewWindow::s_savedIcon;
|
||||
|
||||
QIcon ViewWindow::s_modifiedIcon;
|
||||
|
||||
ViewWindow::ViewWindow(QWidget *p_parent)
|
||||
: QFrame(p_parent)
|
||||
{
|
||||
setupUI();
|
||||
|
||||
initIcons();
|
||||
|
||||
setupShortcuts();
|
||||
|
||||
// Need to use this global-wise way, especially for the WebView.
|
||||
@ -96,6 +102,20 @@ void ViewWindow::setupUI()
|
||||
m_mainLayout->addLayout(m_bottomLayout, 0);
|
||||
}
|
||||
|
||||
void ViewWindow::initIcons()
|
||||
{
|
||||
if (!s_savedIcon.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &themeMgr = VNoteX::getInst().getThemeMgr();
|
||||
const QString savedIconName("buffer.svg");
|
||||
const QString unsavedIconFg("base#icon#warning#fg");
|
||||
s_savedIcon = IconUtils::fetchIcon(themeMgr.getIconFile(savedIconName));
|
||||
s_modifiedIcon = IconUtils::fetchIcon(themeMgr.getIconFile(savedIconName),
|
||||
themeMgr.paletteColor(unsavedIconFg));
|
||||
}
|
||||
|
||||
Buffer *ViewWindow::getBuffer() const
|
||||
{
|
||||
return m_buffer;
|
||||
@ -174,8 +194,11 @@ void ViewWindow::detachFromBuffer(bool p_quiet)
|
||||
|
||||
QIcon ViewWindow::getIcon() const
|
||||
{
|
||||
// Unnecessary to provide an icon for the tab.
|
||||
return QIcon();
|
||||
if (m_buffer) {
|
||||
return m_buffer->isModified() ? s_modifiedIcon : s_savedIcon;
|
||||
} else {
|
||||
return s_savedIcon;
|
||||
}
|
||||
}
|
||||
|
||||
QString ViewWindow::getName() const
|
||||
|
@ -283,6 +283,8 @@ namespace vnotex
|
||||
|
||||
void setupUI();
|
||||
|
||||
void initIcons();
|
||||
|
||||
void setupShortcuts();
|
||||
|
||||
void discardChangesAndRead();
|
||||
@ -376,6 +378,9 @@ namespace vnotex
|
||||
QActionGroup *m_imageHostActionGroup = nullptr;
|
||||
|
||||
bool m_statusWidgetInBottomLayout = false;
|
||||
|
||||
static QIcon s_savedIcon;
|
||||
static QIcon s_modifiedIcon;
|
||||
};
|
||||
} // ns vnotex
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user