|
|
@@ -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
|