minor-fix

This commit is contained in:
Le Tan 2017-07-26 19:20:50 +08:00
parent fc48d69fe0
commit e88a41d4e3
10 changed files with 72 additions and 21 deletions

View File

@ -3,7 +3,7 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <!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" <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"> 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 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"/> s-40,17.998-40,40s17.998,40,40,40S296,278.002,296,256z"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 787 B

View File

@ -3,7 +3,7 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <!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" <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"> 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 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"/> s-40,17.998-40,40s17.998,40,40,40S296,278.002,296,256z"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 787 B

After

Width:  |  Height:  |  Size: 787 B

View File

@ -5,7 +5,7 @@
width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"> width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
<g id="Icon_3_"> <g id="Icon_3_">
<g> <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>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 626 B

After

Width:  |  Height:  |  Size: 647 B

View File

@ -5,7 +5,7 @@
width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"> width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
<g id="Icon_3_"> <g id="Icon_3_">
<g> <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>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 647 B

After

Width:  |  Height:  |  Size: 647 B

View File

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

After

Width:  |  Height:  |  Size: 926 B

View File

@ -26,6 +26,7 @@ VEditWindow::VEditWindow(VNote *vnote, VEditArea *editArea, QWidget *parent)
// Explicit speficy in macOS. // Explicit speficy in macOS.
setUsesScrollButtons(true); setUsesScrollButtons(true);
setElideMode(Qt::ElideRight);
setTabsClosable(true); setTabsClosable(true);
setMovable(true); setMovable(true);
setContextMenuPolicy(Qt::CustomContextMenu); setContextMenuPolicy(Qt::CustomContextMenu);
@ -150,18 +151,18 @@ void VEditWindow::initTabActions()
void VEditWindow::setupCornerWidget() void VEditWindow::setupCornerWidget()
{ {
// Left corner button // Left button
leftBtn = new QPushButton(QIcon(":/resources/icons/corner_tablist.svg"), leftBtn = new QPushButton(QIcon(":/resources/icons/corner_tablist.svg"),
"", this); "", this);
leftBtn->setProperty("CornerBtn", true); leftBtn->setProperty("CornerBtn", true);
leftBtn->setToolTip(tr("Opened Notes List"));
VOpenedListMenu *leftMenu = new VOpenedListMenu(this); VOpenedListMenu *leftMenu = new VOpenedListMenu(this);
leftMenu->setToolTipsVisible(true); leftMenu->setToolTipsVisible(true);
connect(leftMenu, &VOpenedListMenu::fileTriggered, connect(leftMenu, &VOpenedListMenu::fileTriggered,
this, &VEditWindow::tabListJump); this, &VEditWindow::tabListJump);
leftBtn->setMenu(leftMenu); leftBtn->setMenu(leftMenu);
setCornerWidget(leftBtn, Qt::TopLeftCorner);
// Right corner button // Right button
// Actions // Actions
splitAct = new QAction(QIcon(":/resources/icons/split_window.svg"), splitAct = new QAction(QIcon(":/resources/icons/split_window.svg"),
tr("Split"), this); tr("Split"), this);
@ -180,14 +181,25 @@ void VEditWindow::setupCornerWidget()
rightBtn = new QPushButton(QIcon(":/resources/icons/corner_menu.svg"), rightBtn = new QPushButton(QIcon(":/resources/icons/corner_menu.svg"),
"", this); "", this);
rightBtn->setProperty("CornerBtn", true); rightBtn->setProperty("CornerBtn", true);
rightBtn->setToolTip(tr("Menu"));
QMenu *rightMenu = new QMenu(this); QMenu *rightMenu = new QMenu(this);
rightMenu->setToolTipsVisible(true); rightMenu->setToolTipsVisible(true);
rightMenu->addAction(splitAct); rightMenu->addAction(splitAct);
rightMenu->addAction(removeSplitAct); rightMenu->addAction(removeSplitAct);
rightBtn->setMenu(rightMenu); rightBtn->setMenu(rightMenu);
setCornerWidget(rightBtn, Qt::TopRightCorner);
connect(rightMenu, &QMenu::aboutToShow, connect(rightMenu, &QMenu::aboutToShow,
this, &VEditWindow::updateSplitMenu); 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) void VEditWindow::splitWindow(bool p_right)
@ -438,8 +450,14 @@ void VEditWindow::updateTabInfo(int p_index)
setTabText(p_index, generateTabText(p_index, file->getName(), setTabText(p_index, generateTabText(p_index, file->getName(),
file->isModified(), file->isModifiable())); file->isModified(), file->isModifiable()));
setTabToolTip(p_index, generateTooltip(file)); 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() void VEditWindow::updateAllTabsSequence()

View File

@ -661,8 +661,8 @@ void VMainWindow::initFileMenu()
// Import notes from files. // Import notes from files.
m_importNoteAct = newAction(QIcon(":/resources/icons/import_note.svg"), m_importNoteAct = newAction(QIcon(":/resources/icons/import_note.svg"),
tr("&Import Notes From Files"), this); tr("&New Notes From Files"), this);
m_importNoteAct->setToolTip(tr("Import notes from external files into current folder by copy")); m_importNoteAct->setToolTip(tr("Create notes from external files in current folder by copy"));
connect(m_importNoteAct, &QAction::triggered, connect(m_importNoteAct, &QAction::triggered,
this, &VMainWindow::importNoteFromFile); this, &VMainWindow::importNoteFromFile);
m_importNoteAct->setEnabled(false); m_importNoteAct->setEnabled(false);
@ -716,7 +716,12 @@ void VMainWindow::initFileMenu()
this); this);
if (ret == QMessageBox::Ok) { 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()); QUrl url = QUrl::fromLocalFile(vconfig.getConfigFilePath());
#endif
QDesktopServices::openUrl(url); QDesktopServices::openUrl(url);
} }
}); });
@ -996,7 +1001,7 @@ void VMainWindow::importNoteFromFile()
{ {
static QString lastPath = QDir::homePath(); static QString lastPath = QDir::homePath();
QStringList files = QFileDialog::getOpenFileNames(this, QStringList files = QFileDialog::getOpenFileNames(this,
tr("Select Files (HTML or Markdown) To Import"), tr("Select Files (HTML or Markdown) To Create Notes"),
lastPath); lastPath);
if (files.isEmpty()) { if (files.isEmpty()) {
return; return;
@ -1012,13 +1017,15 @@ void VMainWindow::importNoteFromFile()
++failedFiles; ++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), .arg(files.size() - failedFiles).arg(failedFiles),
QMessageBox::Ok, this); QMessageBox::Ok, this);
if (failedFiles > 0) { 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(); msgBox.exec();
} }
@ -1555,11 +1562,12 @@ void VMainWindow::closeEvent(QCloseEvent *event)
vconfig.setMinimizeToSystemTray(0); vconfig.setMinimizeToSystemTray(0);
isExit = true; isExit = true;
} else { } else {
event->ignore();
return; return;
} }
} }
if (isExit) { if (isExit || !m_trayIcon->isVisible()) {
if (!editArea->closeAllFiles(false)) { if (!editArea->closeAllFiles(false)) {
// Fail to close all the opened files, cancel closing app // Fail to close all the opened files, cancel closing app
event->ignore(); event->ignore();

View File

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

View File

@ -165,8 +165,11 @@ bool VNotebookSelector::newNotebook()
QString info(tr("Please type the name of the notebook and " QString info(tr("Please type the name of the notebook and "
"choose a folder as the Root Folder of the notebook.")); "choose a folder as the Root Folder of the notebook."));
info += "\n"; 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."); "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 defaultName;
QString defaultPath; QString defaultPath;

View File

@ -25,11 +25,19 @@ static bool fileComp(const VOpenedListMenu::ItemInfo &a,
} else if (notebooka > notebookb) { } else if (notebooka > notebookb) {
return false; return false;
} else { } else {
QString patha = a.file->retriveRelativePath().toLower(); QString patha = a.file->retriveBasePath();
QString pathb = b.file->retriveRelativePath().toLower(); 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; return patha < pathb;
} }
} }
}
VOpenedListMenu::VOpenedListMenu(VEditWindow *p_editWin) VOpenedListMenu::VOpenedListMenu(VEditWindow *p_editWin)
: QMenu(p_editWin), m_editWin(p_editWin), m_cmdNum(0) : QMenu(p_editWin), m_editWin(p_editWin), m_cmdNum(0)