Browse Source

use different color of the corner icon in current window

Signed-off-by: Le Tan <[email protected]>
Le Tan 9 years ago
parent
commit
58c8506855

+ 9 - 0
src/resources/icons/corner_menu_cur.svg

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path style="fill:#C62828" d="M296,136c0-22.002-17.998-40-40-40s-40,17.998-40,40s17.998,40,40,40S296,158.002,296,136z M296,376
+	c0-22.002-17.998-40-40-40s-40,17.998-40,40s17.998,40,40,40S296,398.002,296,376z M296,256c0-22.002-17.998-40-40-40
+	s-40,17.998-40,40s17.998,40,40,40S296,278.002,296,256z"/>
+</svg>

+ 11 - 0
src/resources/icons/corner_tablist_cur.svg

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_3_">
+	<g>
+		<path style="fill:#C62828" d="M64,384h384v-42.666H64V384z M64,277.334h384v-42.667H64V277.334z M64,128v42.665h384V128H64z"/>
+	</g>
+</g>
+</svg>

+ 8 - 1
src/veditarea.cpp

@@ -133,15 +133,22 @@ void VEditArea::setCurrentTab(int windowIndex, int tabIndex, bool setFocus)
 
 void VEditArea::setCurrentWindow(int windowIndex, bool setFocus)
 {
+    int nrWin = splitter->count();
     if (curWindowIndex == windowIndex) {
         goto out;
     }
     curWindowIndex = windowIndex;
     if (curWindowIndex > -1 && setFocus) {
-        getWindow(windowIndex)->focusWindow();
+        getWindow(curWindowIndex)->focusWindow();
     }
 
 out:
+    for (int i = 0; i < nrWin; ++i) {
+        getWindow(i)->setCurrentWindow(false);
+    }
+    if (curWindowIndex > -1) {
+        getWindow(curWindowIndex)->setCurrentWindow(true);
+    }
     // Update status
     updateWindowStatus();
 }

+ 11 - 0
src/veditwindow.cpp

@@ -694,3 +694,14 @@ bool VEditWindow::addEditTab(QWidget *p_widget)
     noticeTabStatus(idx);
     return true;
 }
+
+void VEditWindow::setCurrentWindow(bool p_current)
+{
+    if (p_current) {
+        rightBtn->setIcon(QIcon(":/resources/icons/corner_menu_cur.svg"));
+        leftBtn->setIcon(QIcon(":/resources/icons/corner_tablist_cur.svg"));
+    } else {
+        rightBtn->setIcon(QIcon(":/resources/icons/corner_menu.svg"));
+        leftBtn->setIcon(QIcon(":/resources/icons/corner_tablist.svg"));
+    }
+}

+ 2 - 0
src/veditwindow.h

@@ -43,6 +43,8 @@ public:
     VEditTab *currentEditTab();
     // Insert a tab with @p_widget. @p_widget is a fully initialized VEditTab.
     bool addEditTab(QWidget *p_widget);
+    // Set whether it is the current window.
+    void setCurrentWindow(bool p_current);
 
 protected:
     void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;

+ 11 - 0
src/vnote.cpp

@@ -55,6 +55,17 @@ void VNote::initPalette(QPalette palette)
     m_palette.append(QPair<QString, QString>("Grey6", "#757575"));
     m_palette.append(QPair<QString, QString>("Grey7", "#616161"));
     m_palette.append(QPair<QString, QString>("Grey8", "#424242"));
+
+    m_palette.append(QPair<QString, QString>("Green0", "#E8F5E9"));
+    m_palette.append(QPair<QString, QString>("Green1", "#C8E6C9"));
+    m_palette.append(QPair<QString, QString>("Green2", "#A5D6A7"));
+    m_palette.append(QPair<QString, QString>("Green3", "#81C784"));
+    m_palette.append(QPair<QString, QString>("Green4", "#66BB6A"));
+    m_palette.append(QPair<QString, QString>("Green5", "#4CAF50"));
+    m_palette.append(QPair<QString, QString>("Green6", "#43A047"));
+    m_palette.append(QPair<QString, QString>("Green7", "#388E3C"));
+    m_palette.append(QPair<QString, QString>("Green8", "#2E7D32"));
+    m_palette.append(QPair<QString, QString>("Green9", "#1B5E20"));
 }
 
 QString VNote::getColorFromPalette(const QString &p_name) const

+ 2 - 0
src/vnote.qrc

@@ -79,5 +79,7 @@
         <file>resources/icons/locate_note.svg</file>
         <file>resources/icons/move_tab_left.svg</file>
         <file>resources/icons/move_tab_right.svg</file>
+        <file>resources/icons/corner_menu_cur.svg</file>
+        <file>resources/icons/corner_tablist_cur.svg</file>
     </qresource>
 </RCC>