Le Tan 8 lat temu
rodzic
commit
e88a41d4e3

+ 1 - 1
src/resources/icons/corner_menu.svg

@@ -3,7 +3,7 @@
 <!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 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
+<path style="fill:#808080" 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>

+ 1 - 1
src/resources/icons/corner_menu_cur.svg

@@ -3,7 +3,7 @@
 <!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:#9C27B0" 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
+<path style="fill:#000000" 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>

+ 1 - 1
src/resources/icons/corner_tablist.svg

@@ -5,7 +5,7 @@
 	 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 d="M64,384h384v-42.666H64V384z M64,277.334h384v-42.667H64V277.334z M64,128v42.665h384V128H64z"/>
+		<path style="fill:#808080" d="M64,384h384v-42.666H64V384z M64,277.334h384v-42.667H64V277.334z M64,128v42.665h384V128H64z"/>
 	</g>
 </g>
 </svg>

+ 1 - 1
src/resources/icons/corner_tablist_cur.svg

@@ -5,7 +5,7 @@
 	 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:#9C27B0" d="M64,384h384v-42.666H64V384z M64,277.334h384v-42.667H64V277.334z M64,128v42.665h384V128H64z"/>
+		<path style="fill:#000000" d="M64,384h384v-42.666H64V384z M64,277.334h384v-42.667H64V277.334z M64,128v42.665h384V128H64z"/>
 	</g>
 </g>
 </svg>

+ 13 - 0
src/resources/icons/editing_modified.svg

@@ -0,0 +1,13 @@
+<?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>
+	
+		<rect style="fill:#C9302C" x="178.846" y="92.087" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 224.3476 631.1498)" width="128.085" height="354.049"/>
+	<path style="fill:#C9302C" d="M471.723,88.393l-48.115-48.114c-11.723-11.724-31.558-10.896-44.304,1.85l-45.202,45.203l90.569,90.568l45.202-45.202
+		C482.616,119.952,483.445,100.116,471.723,88.393z"/>
+	<polygon style="fill:#C9302C" points="64.021,363.252 32,480 148.737,447.979 	"/>
+</g>
+</svg>

+ 24 - 6
src/veditwindow.cpp

@@ -26,6 +26,7 @@ VEditWindow::VEditWindow(VNote *vnote, VEditArea *editArea, QWidget *parent)
 
     // Explicit speficy in macOS.
     setUsesScrollButtons(true);
+    setElideMode(Qt::ElideRight);
     setTabsClosable(true);
     setMovable(true);
     setContextMenuPolicy(Qt::CustomContextMenu);
@@ -150,18 +151,18 @@ void VEditWindow::initTabActions()
 
 void VEditWindow::setupCornerWidget()
 {
-    // Left corner button
+    // Left button
     leftBtn = new QPushButton(QIcon(":/resources/icons/corner_tablist.svg"),
                               "", this);
     leftBtn->setProperty("CornerBtn", true);
+    leftBtn->setToolTip(tr("Opened Notes List"));
     VOpenedListMenu *leftMenu = new VOpenedListMenu(this);
     leftMenu->setToolTipsVisible(true);
     connect(leftMenu, &VOpenedListMenu::fileTriggered,
             this, &VEditWindow::tabListJump);
     leftBtn->setMenu(leftMenu);
-    setCornerWidget(leftBtn, Qt::TopLeftCorner);
 
-    // Right corner button
+    // Right button
     // Actions
     splitAct = new QAction(QIcon(":/resources/icons/split_window.svg"),
                            tr("Split"), this);
@@ -180,14 +181,25 @@ void VEditWindow::setupCornerWidget()
     rightBtn = new QPushButton(QIcon(":/resources/icons/corner_menu.svg"),
                                "", this);
     rightBtn->setProperty("CornerBtn", true);
+    rightBtn->setToolTip(tr("Menu"));
     QMenu *rightMenu = new QMenu(this);
     rightMenu->setToolTipsVisible(true);
     rightMenu->addAction(splitAct);
     rightMenu->addAction(removeSplitAct);
     rightBtn->setMenu(rightMenu);
-    setCornerWidget(rightBtn, Qt::TopRightCorner);
     connect(rightMenu, &QMenu::aboutToShow,
             this, &VEditWindow::updateSplitMenu);
+
+    // Move all buttons to the right corner.
+    QWidget *widget = new QWidget(this);
+    QHBoxLayout *layout = new QHBoxLayout();
+    layout->addWidget(leftBtn);
+    layout->addWidget(rightBtn);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->setSpacing(0);
+    widget->setLayout(layout);
+
+    setCornerWidget(widget, Qt::TopRightCorner);
 }
 
 void VEditWindow::splitWindow(bool p_right)
@@ -438,8 +450,14 @@ void VEditWindow::updateTabInfo(int p_index)
     setTabText(p_index, generateTabText(p_index, file->getName(),
                                         file->isModified(), file->isModifiable()));
     setTabToolTip(p_index, generateTooltip(file));
-    setTabIcon(p_index, editMode ? QIcon(":/resources/icons/editing.svg") :
-               QIcon(":/resources/icons/reading.svg"));
+
+    QString iconUrl(":/resources/icons/reading.svg");
+    if (editMode) {
+        iconUrl = file->isModified() ? ":/resources/icons/editing_modified.svg"
+                                     : ":/resources/icons/editing.svg";
+    }
+
+    setTabIcon(p_index, QIcon(iconUrl));
 }
 
 void VEditWindow::updateAllTabsSequence()

+ 15 - 7
src/vmainwindow.cpp

@@ -661,8 +661,8 @@ void VMainWindow::initFileMenu()
 
     // Import notes from files.
     m_importNoteAct = newAction(QIcon(":/resources/icons/import_note.svg"),
-                                tr("&Import Notes From Files"), this);
-    m_importNoteAct->setToolTip(tr("Import notes from external files into current folder by copy"));
+                                tr("&New Notes From Files"), this);
+    m_importNoteAct->setToolTip(tr("Create notes from external files in current folder by copy"));
     connect(m_importNoteAct, &QAction::triggered,
             this, &VMainWindow::importNoteFromFile);
     m_importNoteAct->setEnabled(false);
@@ -716,7 +716,12 @@ void VMainWindow::initFileMenu()
                               this);
 
                 if (ret == QMessageBox::Ok) {
+#if defined(Q_OS_MACOS) || defined(Q_OS_MAC)
+                    // On macOS, it seems that we could not open that ini file directly.
+                    QUrl url = QUrl::fromLocalFile(vconfig.getConfigFolder());
+#else
                     QUrl url = QUrl::fromLocalFile(vconfig.getConfigFilePath());
+#endif
                     QDesktopServices::openUrl(url);
                 }
             });
@@ -996,7 +1001,7 @@ void VMainWindow::importNoteFromFile()
 {
     static QString lastPath = QDir::homePath();
     QStringList files = QFileDialog::getOpenFileNames(this,
-                                                      tr("Select Files (HTML or Markdown) To Import"),
+                                                      tr("Select Files (HTML or Markdown) To Create Notes"),
                                                       lastPath);
     if (files.isEmpty()) {
         return;
@@ -1012,13 +1017,15 @@ void VMainWindow::importNoteFromFile()
             ++failedFiles;
         }
     }
-    QMessageBox msgBox(QMessageBox::Information, tr("Import Notes From File"),
-                       tr("Imported notes: %1 succeed, %2 failed.")
+
+    QMessageBox msgBox(QMessageBox::Information, tr("New Notes From Files"),
+                       tr("Created notes: %1 succeed, %2 failed.")
                        .arg(files.size() - failedFiles).arg(failedFiles),
                        QMessageBox::Ok, this);
     if (failedFiles > 0) {
-        msgBox.setInformativeText(tr("Fail to import files maybe due to name conflicts."));
+        msgBox.setInformativeText(tr("Fail to create notes from files maybe due to name conflicts."));
     }
+
     msgBox.exec();
 }
 
@@ -1555,11 +1562,12 @@ void VMainWindow::closeEvent(QCloseEvent *event)
             vconfig.setMinimizeToSystemTray(0);
             isExit = true;
         } else {
+            event->ignore();
             return;
         }
     }
 
-    if (isExit) {
+    if (isExit || !m_trayIcon->isVisible()) {
         if (!editArea->closeAllFiles(false)) {
             // Fail to close all the opened files, cancel closing app
             event->ignore();

+ 1 - 0
src/vnote.qrc

@@ -117,5 +117,6 @@
         <file>resources/icons/inline_code.svg</file>
         <file>resources/icons/close_note_tb.svg</file>
         <file>resources/icons/32x32/vnote.png</file>
+        <file>resources/icons/editing_modified.svg</file>
     </qresource>
 </RCC>

+ 4 - 1
src/vnotebookselector.cpp

@@ -165,8 +165,11 @@ bool VNotebookSelector::newNotebook()
     QString info(tr("Please type the name of the notebook and "
                     "choose a folder as the Root Folder of the notebook."));
     info += "\n";
-    info += tr("The root folder should be used EXCLUSIVELY by VNote and "
+    info += tr("* The root folder should be used EXCLUSIVELY by VNote and "
                "it is recommended to be EMPTY.");
+    info += "\n";
+    info += tr("* A previously created notebook could be imported into VNote "
+               "by choosing its root folder.");
 
     QString defaultName;
     QString defaultPath;

+ 11 - 3
src/vopenedlistmenu.cpp

@@ -25,9 +25,17 @@ static bool fileComp(const VOpenedListMenu::ItemInfo &a,
     } else if (notebooka > notebookb) {
         return false;
     } else {
-        QString patha = a.file->retriveRelativePath().toLower();
-        QString pathb = b.file->retriveRelativePath().toLower();
-        return patha < pathb;
+        QString patha = a.file->retriveBasePath();
+        QString pathb = b.file->retriveBasePath();
+#if defined(Q_OS_WIN)
+        patha = patha.toLower();
+        pathb = pathb.toLower();
+#endif
+        if (patha == pathb) {
+            return a.index < b.index;
+        } else {
+            return patha < pathb;
+        }
     }
 }