refine all messages

This commit is contained in:
Le Tan 2017-02-26 20:30:38 +08:00
parent b879b2c208
commit 238983ed0d
21 changed files with 78 additions and 77 deletions

View File

@ -18,7 +18,7 @@ void VDirInfoDialog::setupUI()
if (!info.isEmpty()) { if (!info.isEmpty()) {
infoLabel = new QLabel(info); infoLabel = new QLabel(info);
} }
nameLabel = new QLabel(tr("&Name:")); nameLabel = new QLabel(tr("Directory &name:"));
nameEdit = new QLineEdit(defaultName); nameEdit = new QLineEdit(defaultName);
nameEdit->selectAll(); nameEdit->selectAll();
nameLabel->setBuddy(nameEdit); nameLabel->setBuddy(nameEdit);

View File

@ -18,7 +18,7 @@ void VFileInfoDialog::setupUI()
if (!info.isEmpty()) { if (!info.isEmpty()) {
infoLabel = new QLabel(info); infoLabel = new QLabel(info);
} }
nameLabel = new QLabel(tr("&Name:")); nameLabel = new QLabel(tr("Note &name:"));
nameEdit = new QLineEdit(defaultName); nameEdit = new QLineEdit(defaultName);
nameEdit->selectAll(); nameEdit->selectAll();
nameLabel->setBuddy(nameEdit); nameLabel->setBuddy(nameEdit);

View File

@ -90,7 +90,7 @@ QString VInsertImageDialog::getPathInput() const
void VInsertImageDialog::handleBrowseBtnClicked() void VInsertImageDialog::handleBrowseBtnClicked()
{ {
static QString lastPath = QDir::homePath(); static QString lastPath = QDir::homePath();
QString filePath = QFileDialog::getOpenFileName(this, tr("Select the image to be inserted"), QString filePath = QFileDialog::getOpenFileName(this, tr("Select The Image To Be Inserted"),
lastPath, tr("Images (*.png *.xpm *.jpg *.bmp *.gif)")); lastPath, tr("Images (*.png *.xpm *.jpg *.bmp *.gif)"));
if (filePath.isNull() || filePath.isEmpty()) { if (filePath.isNull() || filePath.isEmpty()) {
return; return;

View File

@ -33,7 +33,7 @@ void VNewNotebookDialog::setupUI()
importCheck = new QCheckBox(tr("Import existing notebook"), this); importCheck = new QCheckBox(tr("Import existing notebook"), this);
importCheck->setChecked(true); importCheck->setChecked(true);
importCheck->setToolTip(tr("When checked, VNote won't create a new config file if there already exists one.")); importCheck->setToolTip(tr("When checked, VNote won't create a new config file if there already exists one"));
QGridLayout *topLayout = new QGridLayout(); QGridLayout *topLayout = new QGridLayout();
topLayout->addWidget(nameLabel, 0, 0); topLayout->addWidget(nameLabel, 0, 0);
@ -77,7 +77,7 @@ QString VNewNotebookDialog::getPathInput() const
void VNewNotebookDialog::handleBrowseBtnClicked() void VNewNotebookDialog::handleBrowseBtnClicked()
{ {
QString dirPath = QFileDialog::getExistingDirectory(this, tr("Select a directory as the path of the notebook"), QString dirPath = QFileDialog::getExistingDirectory(this, tr("Select A Directory For The Notebook"),
QDir::homePath(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); QDir::homePath(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
pathEdit->setText(dirPath); pathEdit->setText(dirPath);
} }

View File

@ -38,7 +38,7 @@ void VSettingsDialog::loadConfiguration()
return; return;
err: err:
VUtils::showMessage(QMessageBox::Warning, tr("Warning"), VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
QString("Failed to load configuration."), "", QString("Fail to load configuration."), "",
QMessageBox::Ok, QMessageBox::Ok, NULL); QMessageBox::Ok, QMessageBox::Ok, NULL);
QMetaObject::invokeMethod(this, "reject", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "reject", Qt::QueuedConnection);
} }
@ -57,7 +57,7 @@ void VSettingsDialog::saveConfiguration()
return; return;
err: err:
VUtils::showMessage(QMessageBox::Warning, tr("Warning"), VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
QString("Failed to save configuration. Please try it again."), "", QString("Fail to save configuration. Please try it again."), "",
QMessageBox::Ok, QMessageBox::Ok, NULL); QMessageBox::Ok, QMessageBox::Ok, NULL);
} }
@ -66,7 +66,7 @@ const QVector<QString> VGeneralTab::c_availableLangs = { "System", "English", "C
VGeneralTab::VGeneralTab(QWidget *p_parent) VGeneralTab::VGeneralTab(QWidget *p_parent)
: QWidget(p_parent), m_langChanged(false) : QWidget(p_parent), m_langChanged(false)
{ {
QLabel *langLabel = new QLabel(tr("Language:")); QLabel *langLabel = new QLabel(tr("&Language:"));
m_langCombo = new QComboBox(this); m_langCombo = new QComboBox(this);
m_langCombo->addItem(tr("System"), "System"); m_langCombo->addItem(tr("System"), "System");
auto langs = VUtils::getAvailableLanguages(); auto langs = VUtils::getAvailableLanguages();
@ -75,6 +75,7 @@ VGeneralTab::VGeneralTab(QWidget *p_parent)
} }
connect(m_langCombo, SIGNAL(currentIndexChanged(int)), connect(m_langCombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(handleIndexChange(int))); this, SLOT(handleIndexChange(int)));
langLabel->setBuddy(m_langCombo);
QFormLayout *optionLayout = new QFormLayout(); QFormLayout *optionLayout = new QFormLayout();
optionLayout->addRow(langLabel, m_langCombo); optionLayout->addRow(langLabel, m_langCombo);
@ -120,7 +121,7 @@ bool VGeneralTab::loadLanguage()
} }
} }
if (!found) { if (!found) {
qWarning() << "invalid language configuration (use default value)"; qWarning() << "invalid language configuration (using default value)";
m_langCombo->setCurrentIndex(0); m_langCombo->setCurrentIndex(0);
} }
return true; return true;

View File

@ -241,7 +241,7 @@ void HGMarkdownHighlighter::parse()
parseInternal(); parseInternal();
if (highlightingStyles.isEmpty()) { if (highlightingStyles.isEmpty()) {
qWarning() << "error: HighlightingStyles is not set"; qWarning() << "HighlightingStyles is not set";
return; return;
} }
initBlockHighlightFromResult(nrBlocks); initBlockHighlightFromResult(nrBlocks);

View File

@ -21,7 +21,7 @@ QString VUtils::readFileFromDisk(const QString &filePath)
{ {
QFile file(filePath); QFile file(filePath);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qWarning() << "error: fail to read file" << filePath; qWarning() << "fail to read file" << filePath;
return QString(); return QString();
} }
QString fileText(file.readAll()); QString fileText(file.readAll());
@ -34,7 +34,7 @@ bool VUtils::writeFileToDisk(const QString &filePath, const QString &text)
{ {
QFile file(filePath); QFile file(filePath);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
qWarning() << "error: fail to open file" << filePath << "to write to"; qWarning() << "fail to open file" << filePath << "to write";
return false; return false;
} }
QTextStream stream(&file); QTextStream stream(&file);
@ -62,7 +62,7 @@ QRgb VUtils::QRgbFromString(const QString &str)
if (ret) { if (ret) {
return qRgb(red, green, blue); return qRgb(red, green, blue);
} }
qWarning() << "error: fail to construct QRgb from string" << str; qWarning() << "fail to construct QRgb from string" << str;
return QRgb(); return QRgb();
} }
@ -194,12 +194,12 @@ bool VUtils::copyFile(const QString &p_srcFilePath, const QString &p_destFilePat
if (p_isCut) { if (p_isCut) {
QFile file(srcPath); QFile file(srcPath);
if (!file.rename(destPath)) { if (!file.rename(destPath)) {
qWarning() << "error: fail to copy file" << srcPath << destPath; qWarning() << "fail to copy file" << srcPath << destPath;
return false; return false;
} }
} else { } else {
if (!QFile::copy(srcPath, destPath)) { if (!QFile::copy(srcPath, destPath)) {
qWarning() << "error: fail to copy file" << srcPath << destPath; qWarning() << "fail to copy file" << srcPath << destPath;
return false; return false;
} }
} }
@ -219,7 +219,7 @@ bool VUtils::copyDirectory(const QString &p_srcDirPath, const QString &p_destDir
QDir parentDir(VUtils::basePathFromPath(p_destDirPath)); QDir parentDir(VUtils::basePathFromPath(p_destDirPath));
QString dirName = VUtils::fileNameFromPath(p_destDirPath); QString dirName = VUtils::fileNameFromPath(p_destDirPath);
if (!parentDir.mkdir(dirName)) { if (!parentDir.mkdir(dirName)) {
qWarning() << QString("failed to create target directory %1: already exists").arg(p_destDirPath); qWarning() << QString("fail to create target directory %1: already exists").arg(p_destDirPath);
return false; return false;
} }
@ -247,7 +247,7 @@ bool VUtils::copyDirectory(const QString &p_srcDirPath, const QString &p_destDir
// Delete the src dir if p_isCut // Delete the src dir if p_isCut
if (p_isCut) { if (p_isCut) {
if (!srcDir.removeRecursively()) { if (!srcDir.removeRecursively()) {
qWarning() << "failed to remove directory" << p_srcDirPath; qWarning() << "fail to remove directory" << p_srcDirPath;
return false; return false;
} }
} }

View File

@ -165,7 +165,7 @@ QJsonObject VConfigManager::readDirectoryConfig(const QString &path)
qDebug() << "read config file:" << configFile; qDebug() << "read config file:" << configFile;
QFile config(configFile); QFile config(configFile);
if (!config.open(QIODevice::ReadOnly)) { if (!config.open(QIODevice::ReadOnly)) {
qWarning() << "error: fail to read directory configuration file:" qWarning() << "fail to read directory configuration file:"
<< configFile; << configFile;
return QJsonObject(); return QJsonObject();
} }
@ -188,7 +188,7 @@ bool VConfigManager::writeDirectoryConfig(const QString &path, const QJsonObject
qDebug() << "write config file:" << configFile; qDebug() << "write config file:" << configFile;
QFile config(configFile); QFile config(configFile);
if (!config.open(QIODevice::WriteOnly)) { if (!config.open(QIODevice::WriteOnly)) {
qWarning() << "error: fail to open directory configuration file for write:" qWarning() << "fail to open directory configuration file for write:"
<< configFile; << configFile;
return false; return false;
} }
@ -204,7 +204,7 @@ bool VConfigManager::deleteDirectoryConfig(const QString &path)
QFile config(configFile); QFile config(configFile);
if (!config.remove()) { if (!config.remove()) {
qWarning() << "error: fail to delete directory configuration file:" qWarning() << "fail to delete directory configuration file:"
<< configFile; << configFile;
return false; return false;
} }

View File

@ -117,7 +117,7 @@ VDirectory *VDirectory::createSubDirectory(const QString &p_name)
QString path = retrivePath(); QString path = retrivePath();
QDir dir(path); QDir dir(path);
if (!dir.mkdir(p_name)) { if (!dir.mkdir(p_name)) {
qWarning() << "failed to create directory" << p_name << "under" << path; qWarning() << "fail to create directory" << p_name << "under" << path;
return NULL; return NULL;
} }
@ -210,7 +210,7 @@ VFile *VDirectory::createFile(const QString &p_name)
QString filePath = QDir(path).filePath(p_name); QString filePath = QDir(path).filePath(p_name);
QFile file(filePath); QFile file(filePath);
if (!file.open(QIODevice::WriteOnly)) { if (!file.open(QIODevice::WriteOnly)) {
qWarning() << "failed to create file" << p_name; qWarning() << "fail to create file" << p_name;
return NULL; return NULL;
} }
file.close(); file.close();
@ -330,7 +330,7 @@ void VDirectory::deleteSubDirectory(VDirectory *p_subDir)
p_subDir->close(); p_subDir->close();
QDir dir(dirPath); QDir dir(dirPath);
if (!dir.removeRecursively()) { if (!dir.removeRecursively()) {
qWarning() << "failed to remove" << dirPath << "recursively"; qWarning() << "fail to remove" << dirPath << "recursively";
} else { } else {
qDebug() << "deleted" << dirPath; qDebug() << "deleted" << dirPath;
} }
@ -370,7 +370,7 @@ int VDirectory::removeSubDirectory(VDirectory *p_dir)
Q_ASSERT(deleted); Q_ASSERT(deleted);
dirJson["sub_directories"] = subDirArray; dirJson["sub_directories"] = subDirArray;
if (!VConfigManager::writeDirectoryConfig(path, dirJson)) { if (!VConfigManager::writeDirectoryConfig(path, dirJson)) {
qWarning() << "failed to update configuration in" << path; qWarning() << "fail to update configuration in" << path;
} }
return index; return index;
} }
@ -409,7 +409,7 @@ int VDirectory::removeFile(VFile *p_file)
Q_ASSERT(deleted); Q_ASSERT(deleted);
dirJson["files"] = subFileArray; dirJson["files"] = subFileArray;
if (!VConfigManager::writeDirectoryConfig(path, dirJson)) { if (!VConfigManager::writeDirectoryConfig(path, dirJson)) {
qWarning() << "failed to update configuration in" << path; qWarning() << "fail to update configuration in" << path;
} }
return index; return index;
} }
@ -435,7 +435,7 @@ bool VDirectory::rename(const QString &p_name)
QDir dir(parentPath); QDir dir(parentPath);
QString name = m_name; QString name = m_name;
if (!dir.rename(m_name, p_name)) { if (!dir.rename(m_name, p_name)) {
qWarning() << "failed to rename directory" << m_name << "to" << p_name; qWarning() << "fail to rename directory" << m_name << "to" << p_name;
return false; return false;
} }
m_name = p_name; m_name = p_name;
@ -522,8 +522,8 @@ VFile *VDirectory::copyFile(VDirectory *p_destDir, const QString &p_destName,
nrPasted++; nrPasted++;
} else { } else {
VUtils::showMessage(QMessageBox::Warning, tr("Warning"), VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
QString("Failed to copy image %1.").arg(images[i]), QString("Fail to copy image %1.").arg(images[i]),
tr("Please check if there already exists a file with the same name and manually copy it."), tr("Please check if there already exists a file with the same name and then manually copy it."),
QMessageBox::Ok, QMessageBox::Ok, NULL); QMessageBox::Ok, QMessageBox::Ok, NULL);
} }
} }
@ -591,7 +591,7 @@ void VDirectory::reorderFiles(int p_first, int p_last, int p_destStart)
Q_ASSERT(p_destStart >= 0 && p_destStart <= m_files.size()); Q_ASSERT(p_destStart >= 0 && p_destStart <= m_files.size());
if (!reorderFilesInConfig(p_first, p_last, p_destStart)) { if (!reorderFilesInConfig(p_first, p_last, p_destStart)) {
qWarning() << "failed to reorder files in config" << p_first << p_last << p_destStart; qWarning() << "fail to reorder files in config" << p_first << p_last << p_destStart;
return; return;
} }

View File

@ -65,7 +65,7 @@ void VDirectoryTree::initActions()
pasteAct = new QAction(QIcon(":/resources/icons/paste.svg"), pasteAct = new QAction(QIcon(":/resources/icons/paste.svg"),
tr("&Paste"), this); tr("&Paste"), this);
pasteAct->setStatusTip(tr("Paste directories")); pasteAct->setStatusTip(tr("Paste directories under this directory"));
connect(pasteAct, &QAction::triggered, connect(pasteAct, &QAction::triggered,
this, &VDirectoryTree::pasteDirectoriesInCurDir); this, &VDirectoryTree::pasteDirectoriesInCurDir);
} }
@ -91,7 +91,7 @@ void VDirectoryTree::setNotebook(VNotebook *p_notebook)
} }
if (!m_notebook->open()) { if (!m_notebook->open()) {
VUtils::showMessage(QMessageBox::Warning, tr("Warning"), VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
QString("Failed to open notebook %1").arg(m_notebook->getName()), "", QString("Fail to open notebook %1.").arg(m_notebook->getName()), "",
QMessageBox::Ok, QMessageBox::Ok, this); QMessageBox::Ok, QMessageBox::Ok, this);
clear(); clear();
return; return;
@ -134,7 +134,7 @@ void VDirectoryTree::updateDirectoryTreeOne(QTreeWidgetItem *p_parent, int depth
VDirectory *dir = getVDirectory(p_parent); VDirectory *dir = getVDirectory(p_parent);
if (!dir->open()) { if (!dir->open()) {
VUtils::showMessage(QMessageBox::Warning, tr("Warning"), VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
QString("Failed to open directory %1").arg(dir->getName()), "", QString("Fail to open directory %1.").arg(dir->getName()), "",
QMessageBox::Ok, QMessageBox::Ok, this); QMessageBox::Ok, QMessageBox::Ok, this);
return; return;
} }
@ -296,7 +296,7 @@ void VDirectoryTree::newSubDirectory()
VDirectory *curDir = getVDirectory(curItem); VDirectory *curDir = getVDirectory(curItem);
QString info = QString("Create sub-directory under %1.").arg(curDir->getName()); QString info = QString("Create sub-directory under %1.").arg(curDir->getName());
QString text("&Directory name:"); QString text("Directory &name:");
QString defaultText("new_directory"); QString defaultText("new_directory");
do { do {
@ -311,7 +311,7 @@ void VDirectoryTree::newSubDirectory()
VDirectory *subDir = curDir->createSubDirectory(name); VDirectory *subDir = curDir->createSubDirectory(name);
if (!subDir) { if (!subDir) {
VUtils::showMessage(QMessageBox::Warning, tr("Warning"), VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
QString("Failed to create directory %1.").arg(name), "", QString("Fail to create directory %1.").arg(name), "",
QMessageBox::Ok, QMessageBox::Ok, this); QMessageBox::Ok, QMessageBox::Ok, this);
return; return;
} }
@ -328,7 +328,7 @@ void VDirectoryTree::newRootDirectory()
return; return;
} }
QString info = QString("Create root directory in notebook %1.").arg(m_notebook->getName()); QString info = QString("Create root directory in notebook %1.").arg(m_notebook->getName());
QString text("&Directory name:"); QString text("Directory &name:");
QString defaultText("new_directory"); QString defaultText("new_directory");
VDirectory *rootDir = m_notebook->getRootDir(); VDirectory *rootDir = m_notebook->getRootDir();
do { do {
@ -343,7 +343,7 @@ void VDirectoryTree::newRootDirectory()
VDirectory *subDir = rootDir->createSubDirectory(name); VDirectory *subDir = rootDir->createSubDirectory(name);
if (!subDir) { if (!subDir) {
VUtils::showMessage(QMessageBox::Warning, tr("Warning"), VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
QString("Failed to create directory %1.").arg(name), "", QString("Fail to create directory %1.").arg(name), "",
QMessageBox::Ok, QMessageBox::Ok, this); QMessageBox::Ok, QMessageBox::Ok, this);
return; return;
} }
@ -410,7 +410,7 @@ void VDirectoryTree::editDirectoryInfo()
} }
if (!curDir->rename(name)) { if (!curDir->rename(name)) {
VUtils::showMessage(QMessageBox::Warning, tr("Warning"), VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
QString("Failed to rename directory %1.").arg(curName), "", QString("Fail to rename directory %1.").arg(curName), "",
QMessageBox::Ok, QMessageBox::Ok, this); QMessageBox::Ok, QMessageBox::Ok, this);
return; return;
} }
@ -552,8 +552,8 @@ bool VDirectoryTree::copyDirectory(VDirectory *p_destDir, const QString &p_destN
emit directoryUpdated(destDir); emit directoryUpdated(destDir);
} else { } else {
VUtils::showMessage(QMessageBox::Warning, tr("Warning"), VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
QString("Failed to copy directory %1.").arg(srcName), QString("Fail to copy directory %1.").arg(srcName),
QString("Please check if there alread exists a directory with the same name"), QString("Please check if there alread exists a directory with the same name."),
QMessageBox::Ok, QMessageBox::Ok, this); QMessageBox::Ok, QMessageBox::Ok, this);
} }

View File

@ -79,7 +79,7 @@ void VEditTab::setupUI()
webPreviewer = NULL; webPreviewer = NULL;
break; break;
default: default:
qWarning() << "error: unknown doc type" << int(m_file->getDocType()); qWarning() << "unknown doc type" << int(m_file->getDocType());
Q_ASSERT(false); Q_ASSERT(false);
} }
} }
@ -119,7 +119,7 @@ void VEditTab::showFileReadMode()
scrollPreviewToHeader(outlineIndex); scrollPreviewToHeader(outlineIndex);
break; break;
default: default:
qWarning() << "error: unknown doc type" << int(m_file->getDocType()); qWarning() << "unknown doc type" << int(m_file->getDocType());
Q_ASSERT(false); Q_ASSERT(false);
} }
noticeStatusChanged(); noticeStatusChanged();
@ -221,7 +221,7 @@ void VEditTab::readFile()
// Nothing to do if user cancel this action // Nothing to do if user cancel this action
return; return;
default: default:
qWarning() << "error: wrong return value from QMessageBox:" << ret; qWarning() << "wrong return value from QMessageBox:" << ret;
return; return;
} }
} }
@ -240,7 +240,7 @@ bool VEditTab::saveFile()
QString filePath = m_file->retrivePath(); QString filePath = m_file->retrivePath();
if (!QFile(filePath).exists()) { if (!QFile(filePath).exists()) {
qWarning() << filePath << "being written has been removed"; qWarning() << filePath << "being written has been removed";
VUtils::showMessage(QMessageBox::Warning, tr("Warning"), tr("Fail to save note"), VUtils::showMessage(QMessageBox::Warning, tr("Warning"), tr("Fail to save note."),
QString("%1 being written has been removed.").arg(filePath), QString("%1 being written has been removed.").arg(filePath),
QMessageBox::Ok, QMessageBox::Ok, this); QMessageBox::Ok, QMessageBox::Ok, this);
return false; return false;
@ -248,7 +248,7 @@ bool VEditTab::saveFile()
m_textEditor->saveFile(); m_textEditor->saveFile();
ret = m_file->save(); ret = m_file->save();
if (!ret) { if (!ret) {
VUtils::showMessage(QMessageBox::Warning, tr("Warning"), tr("Fail to save note"), VUtils::showMessage(QMessageBox::Warning, tr("Warning"), tr("Fail to save note."),
QString("Fail to write to disk when saving a note. Please try it again."), QString("Fail to write to disk when saving a note. Please try it again."),
QMessageBox::Ok, QMessageBox::Ok, this); QMessageBox::Ok, QMessageBox::Ok, this);
m_textEditor->setModified(true); m_textEditor->setModified(true);
@ -312,11 +312,11 @@ void VEditTab::updateTocFromHtml(const QString &tocHtml)
if (xml.name() == "ul") { if (xml.name() == "ul") {
parseTocUl(xml, headers, 1); parseTocUl(xml, headers, 1);
} else { } else {
qWarning() << "error: TOC HTML does not start with <ul>"; qWarning() << "TOC HTML does not start with <ul>";
} }
} }
if (xml.hasError()) { if (xml.hasError()) {
qWarning() << "error: fail to parse TOC in HTML"; qWarning() << "fail to parse TOC in HTML";
return; return;
} }
} }
@ -348,7 +348,7 @@ void VEditTab::parseTocUl(QXmlStreamReader &xml, QVector<VHeader> &headers, int
if (xml.name() == "li") { if (xml.name() == "li") {
parseTocLi(xml, headers, level); parseTocLi(xml, headers, level);
} else { } else {
qWarning() << "error: TOC HTML <ul> should contain <li>" << xml.name(); qWarning() << "TOC HTML <ul> should contain <li>" << xml.name();
break; break;
} }
} }
@ -366,7 +366,7 @@ void VEditTab::parseTocLi(QXmlStreamReader &xml, QVector<VHeader> &headers, int
if (xml.tokenString() == "Characters") { if (xml.tokenString() == "Characters") {
name = xml.text().toString(); name = xml.text().toString();
} else if (!xml.isEndElement()) { } else if (!xml.isEndElement()) {
qWarning() << "error: TOC HTML <a> should be ended by </a>" << xml.name(); qWarning() << "TOC HTML <a> should be ended by </a>" << xml.name();
return; return;
} }
VHeader header(level, name, anchor, -1); VHeader header(level, name, anchor, -1);
@ -381,7 +381,7 @@ void VEditTab::parseTocLi(QXmlStreamReader &xml, QVector<VHeader> &headers, int
headers.append(header); headers.append(header);
parseTocUl(xml, headers, level + 1); parseTocUl(xml, headers, level + 1);
} else { } else {
qWarning() << "error: TOC HTML <li> should contain <a> or <ul>" << xml.name(); qWarning() << "TOC HTML <li> should contain <a> or <ul>" << xml.name();
return; return;
} }
} }

View File

@ -41,7 +41,7 @@ VEditWindow::VEditWindow(VNote *vnote, VEditArea *editArea, QWidget *parent)
void VEditWindow::initTabActions() void VEditWindow::initTabActions()
{ {
m_locateAct = new QAction(QIcon(":/resources/icons/locate_note.svg"), m_locateAct = new QAction(QIcon(":/resources/icons/locate_note.svg"),
tr("Locate"), this); tr("Locate To Directory"), this);
m_locateAct->setStatusTip(tr("Locate the directory of current note")); m_locateAct->setStatusTip(tr("Locate the directory of current note"));
connect(m_locateAct, &QAction::triggered, connect(m_locateAct, &QAction::triggered,
this, &VEditWindow::handleLocateAct); this, &VEditWindow::handleLocateAct);

View File

@ -52,7 +52,7 @@ void VFile::deleteDiskFile()
if (file.remove()) { if (file.remove()) {
qDebug() << "deleted" << filePath; qDebug() << "deleted" << filePath;
} else { } else {
qWarning() << "failed to delete" << filePath; qWarning() << "fail to delete" << filePath;
} }
} }

View File

@ -72,7 +72,7 @@ void VFileList::initActions()
pasteAct = new QAction(QIcon(":/resources/icons/paste.svg"), pasteAct = new QAction(QIcon(":/resources/icons/paste.svg"),
tr("&Paste"), this); tr("&Paste"), this);
pasteAct->setStatusTip(tr("Paste notes")); pasteAct->setStatusTip(tr("Paste notes in current directory"));
connect(pasteAct, &QAction::triggered, connect(pasteAct, &QAction::triggered,
this, &VFileList::pasteFilesInCurDir); this, &VFileList::pasteFilesInCurDir);
} }
@ -188,7 +188,7 @@ void VFileList::newFile()
VFile *file = m_directory->createFile(name); VFile *file = m_directory->createFile(name);
if (!file) { if (!file) {
VUtils::showMessage(QMessageBox::Warning, tr("Warning"), VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
QString("Failed to create file %1.").arg(name), "", QString("Fail to create note %1.").arg(name), "",
QMessageBox::Ok, QMessageBox::Ok, this); QMessageBox::Ok, QMessageBox::Ok, this);
return; return;
} }

View File

@ -141,13 +141,13 @@ void VMainWindow::initViewToolBar()
QAction *onePanelViewAct = new QAction(QIcon(":/resources/icons/one_panel.svg"), QAction *onePanelViewAct = new QAction(QIcon(":/resources/icons/one_panel.svg"),
tr("&Single Panel"), this); tr("&Single Panel"), this);
onePanelViewAct->setStatusTip(tr("Display only the note panel")); onePanelViewAct->setStatusTip(tr("Display only the note list panel"));
connect(onePanelViewAct, &QAction::triggered, connect(onePanelViewAct, &QAction::triggered,
this, &VMainWindow::onePanelView); this, &VMainWindow::onePanelView);
QAction *twoPanelViewAct = new QAction(QIcon(":/resources/icons/two_panels.svg"), QAction *twoPanelViewAct = new QAction(QIcon(":/resources/icons/two_panels.svg"),
tr("&Two Panels"), this); tr("&Two Panels"), this);
twoPanelViewAct->setStatusTip(tr("Display both the directory and note panel")); twoPanelViewAct->setStatusTip(tr("Display both the directory and note list panel"));
connect(twoPanelViewAct, &QAction::triggered, connect(twoPanelViewAct, &QAction::triggered,
this, &VMainWindow::twoPanelView); this, &VMainWindow::twoPanelView);
@ -188,7 +188,7 @@ void VMainWindow::initFileToolBar()
noteInfoAct = new QAction(QIcon(":/resources/icons/note_info_tb.svg"), noteInfoAct = new QAction(QIcon(":/resources/icons/note_info_tb.svg"),
tr("Note &Info"), this); tr("Note &Info"), this);
noteInfoAct->setStatusTip(tr("View and edit info of current note")); noteInfoAct->setStatusTip(tr("View and edit the information of current note"));
connect(noteInfoAct, &QAction::triggered, connect(noteInfoAct, &QAction::triggered,
this, &VMainWindow::curEditFileInfo); this, &VMainWindow::curEditFileInfo);
@ -225,7 +225,7 @@ void VMainWindow::initFileToolBar()
saveNoteAct = new QAction(QIcon(":/resources/icons/save_note.svg"), saveNoteAct = new QAction(QIcon(":/resources/icons/save_note.svg"),
tr("Save"), this); tr("Save"), this);
saveNoteAct->setStatusTip(tr("Save changes of current note")); saveNoteAct->setStatusTip(tr("Save changes to current note"));
saveNoteAct->setShortcut(QKeySequence::Save); saveNoteAct->setShortcut(QKeySequence::Save);
connect(saveNoteAct, &QAction::triggered, connect(saveNoteAct, &QAction::triggered,
editArea, &VEditArea::saveFile); editArea, &VEditArea::saveFile);
@ -340,7 +340,7 @@ void VMainWindow::initEditMenu()
// Insert image. // Insert image.
m_insertImageAct = new QAction(QIcon(":/resources/icons/insert_image.svg"), m_insertImageAct = new QAction(QIcon(":/resources/icons/insert_image.svg"),
tr("Insert &Image"), this); tr("Insert &Image"), this);
m_insertImageAct->setStatusTip(tr("Insert an image from file in current note")); m_insertImageAct->setStatusTip(tr("Insert an image from file into current note"));
connect(m_insertImageAct, &QAction::triggered, connect(m_insertImageAct, &QAction::triggered,
this, &VMainWindow::insertImage); this, &VMainWindow::insertImage);
@ -418,8 +418,8 @@ void VMainWindow::initEditMenu()
this, &VMainWindow::changeHighlightCursorLine); this, &VMainWindow::changeHighlightCursorLine);
// Highlight selected word. // Highlight selected word.
QAction *selectedWordAct = new QAction(tr("Highlight Selected Word"), this); QAction *selectedWordAct = new QAction(tr("Highlight Selected Words"), this);
selectedWordAct->setStatusTip(tr("Highlight all occurences of selected word")); selectedWordAct->setStatusTip(tr("Highlight all occurences of selected words"));
selectedWordAct->setCheckable(true); selectedWordAct->setCheckable(true);
connect(selectedWordAct, &QAction::triggered, connect(selectedWordAct, &QAction::triggered,
this, &VMainWindow::changeHighlightSelectedWord); this, &VMainWindow::changeHighlightSelectedWord);
@ -544,7 +544,7 @@ void VMainWindow::importNoteFromFile()
.arg(files.size() - failedFiles.size()).arg(failedFiles.size()), .arg(files.size() - failedFiles.size()).arg(failedFiles.size()),
QMessageBox::Ok, this); QMessageBox::Ok, this);
if (!failedFiles.isEmpty()) { if (!failedFiles.isEmpty()) {
msgBox.setInformativeText(tr("Failed to import files maybe due to name conflicts.")); msgBox.setInformativeText(tr("Fail to import files maybe due to name conflicts."));
} }
msgBox.exec(); msgBox.exec();
} }

View File

@ -57,7 +57,7 @@ void VMdEditOperations::insertImageFromQImage(const QString &title, const QStrin
VUtils::makeDirectory(path); VUtils::makeDirectory(path);
bool ret = image.save(filePath); bool ret = image.save(filePath);
if (!ret) { if (!ret) {
QMessageBox msgBox(QMessageBox::Warning, tr("Warning"), QString("Fail to save image %1").arg(filePath), QMessageBox msgBox(QMessageBox::Warning, tr("Warning"), QString("Fail to save image %1.").arg(filePath),
QMessageBox::Ok, (QWidget *)m_editor); QMessageBox::Ok, (QWidget *)m_editor);
msgBox.exec(); msgBox.exec();
return; return;
@ -81,8 +81,8 @@ void VMdEditOperations::insertImageFromPath(const QString &title,
VUtils::makeDirectory(path); VUtils::makeDirectory(path);
bool ret = QFile::copy(oriImagePath, filePath); bool ret = QFile::copy(oriImagePath, filePath);
if (!ret) { if (!ret) {
qWarning() << "error: fail to copy" << oriImagePath << "to" << filePath; qWarning() << "fail to copy" << oriImagePath << "to" << filePath;
QMessageBox msgBox(QMessageBox::Warning, tr("Warning"), QString("Fail to save image %1").arg(filePath), QMessageBox msgBox(QMessageBox::Warning, tr("Warning"), QString("Fail to save image %1.").arg(filePath),
QMessageBox::Ok, (QWidget *)m_editor); QMessageBox::Ok, (QWidget *)m_editor);
msgBox.exec(); msgBox.exec();
return; return;
@ -109,7 +109,7 @@ bool VMdEditOperations::insertImageFromURL(const QUrl &imageUrl)
image = QImage(imagePath); image = QImage(imagePath);
if (image.isNull()) { if (image.isNull()) {
qWarning() << "error: image is null"; qWarning() << "image is null";
return false; return false;
} }
title = "Insert Image From File"; title = "Insert Image From File";

View File

@ -72,7 +72,7 @@ void VNotebook::deleteNotebook(VNotebook *p_notebook)
QDir dir(path); QDir dir(path);
if (!dir.removeRecursively()) { if (!dir.removeRecursively()) {
qWarning() << "failed to delete" << path; qWarning() << "fail to delete" << path;
} }
} }

View File

@ -52,7 +52,7 @@ void VNotebookSelector::initActions()
m_notebookInfoAct = new QAction(QIcon(":/resources/icons/notebook_info.svg"), m_notebookInfoAct = new QAction(QIcon(":/resources/icons/notebook_info.svg"),
tr("&Info")); tr("&Info"));
m_notebookInfoAct->setStatusTip(tr("View and edit current notebook's information")); m_notebookInfoAct->setStatusTip(tr("View and edit information of current notebook"));
connect(m_notebookInfoAct, SIGNAL(triggered(bool)), connect(m_notebookInfoAct, SIGNAL(triggered(bool)),
this, SLOT(editNotebookInfo())); this, SLOT(editNotebookInfo()));
} }

View File

@ -43,7 +43,7 @@ bool VSingleInstanceGuard::tryRun()
{ {
// If we can attach to the sharedmemory, there is another instance running. // If we can attach to the sharedmemory, there is another instance running.
if (tryAttach()) { if (tryAttach()) {
qDebug() << "Another instance is running"; qDebug() << "another instance is running";
return false; return false;
} }
@ -62,11 +62,11 @@ bool VSingleInstanceGuard::tryRun()
} else { } else {
// Maybe another thread create it // Maybe another thread create it
if (tryAttach()) { if (tryAttach()) {
qDebug() << "Another instance is running"; qDebug() << "another instance is running";
return false; return false;
} else { } else {
// Something wrong here // Something wrong here
qWarning() << "error: failed to create or attach shared memory segment"; qWarning() << "fail to create or attach shared memory segment";
return false; return false;
} }
} }

View File

@ -35,7 +35,7 @@ QBrush VStyleParser::QBrushFromPmhAttr(pmh_attr_argb_color *attr) const
void markdownStyleErrorCB(char *errMsg, int lineNr, void *context) void markdownStyleErrorCB(char *errMsg, int lineNr, void *context)
{ {
(void)context; (void)context;
qDebug() << "parser error:" << errMsg << lineNr; qWarning() << "parser error:" << errMsg << lineNr;
} }
QTextCharFormat VStyleParser::QTextCharFormatFromAttrs(pmh_style_attribute *attrs, QTextCharFormat VStyleParser::QTextCharFormatFromAttrs(pmh_style_attribute *attrs,
@ -96,7 +96,7 @@ QTextCharFormat VStyleParser::QTextCharFormatFromAttrs(pmh_style_attribute *attr
} }
default: default:
qWarning() << "warning: unimplemented format attr type:" << attrs->type; qWarning() << "unimplemented format attr type:" << attrs->type;
break; break;
} }
attrs = attrs->next; attrs = attrs->next;
@ -157,7 +157,7 @@ void VStyleParser::fetchMarkdownEditorStyles(QPalette &palette, QFont &font) con
} }
default: default:
qWarning() << "warning: unimplemented editor attr type:" << editorStyles->type; qWarning() << "unimplemented editor attr type:" << editorStyles->type;
} }
editorStyles = editorStyles->next; editorStyles = editorStyles->next;
} }
@ -165,7 +165,7 @@ void VStyleParser::fetchMarkdownEditorStyles(QPalette &palette, QFont &font) con
// editor-current-line // editor-current-line
pmh_style_attribute *curLineStyles = markdownStyles->editor_current_line_styles; pmh_style_attribute *curLineStyles = markdownStyles->editor_current_line_styles;
if (curLineStyles) { if (curLineStyles) {
qDebug() << "editor-current-line style is not supported"; qWarning() << "editor-current-line style is not supported";
} }
// editor-selection // editor-selection
@ -183,7 +183,7 @@ void VStyleParser::fetchMarkdownEditorStyles(QPalette &palette, QFont &font) con
break; break;
default: default:
qWarning() << "warning: unimplemented selection attr type:" << selStyles->type; qWarning() << "unimplemented selection attr type:" << selStyles->type;
} }
selStyles = selStyles->next; selStyles = selStyles->next;
} }