From 36e335bd72b02dd40f87fc274ea7190191527ff9 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Fri, 4 Sep 2020 20:25:55 +0800 Subject: [PATCH] VSync: add support for linux/mac --- src/utils/vSync.cpp | 4 ++++ src/vmainwindow.cpp | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/utils/vSync.cpp b/src/utils/vSync.cpp index e22ad86a..dce5d086 100644 --- a/src/utils/vSync.cpp +++ b/src/utils/vSync.cpp @@ -123,7 +123,11 @@ void VSync::onProcessFinish(int exitCode) void VSync::start(const QString &cmd) { +#if defined(Q_OS_WIN) m_process->start("cmd", QStringList() << "/c" << cmd); +#else + m_process->start("/bin/sh", QStringList() << "-c" << cmd); +#endif m_process->waitForStarted(); } diff --git a/src/vmainwindow.cpp b/src/vmainwindow.cpp index 485e3efd..9cce375a 100644 --- a/src/vmainwindow.cpp +++ b/src/vmainwindow.cpp @@ -998,15 +998,15 @@ void VMainWindow::initMarkdownMenu() void VMainWindow::initSyncMenu() { - m_syncMenu = menuBar()->addMenu(tr("&Sync")); + m_syncMenu = menuBar()->addMenu(tr("Git &Sync")); m_syncMenu->setToolTipsVisible(true); - QAction* uploadAction = new QAction(tr("&Upload"), this); - uploadAction->setToolTip(tr("upload note")); - connect(uploadAction, &QAction::triggered, this, &VMainWindow::upload); + QAction* uploadAction = new QAction(tr("&Upload"), this); + uploadAction->setToolTip(tr("Upload notes to Git repo")); + connect(uploadAction, &QAction::triggered, this, &VMainWindow::upload); m_syncMenu->addAction(uploadAction); QAction* downloadAction = new QAction(tr("&Download"), this); - downloadAction->setToolTip(tr("download note")); + downloadAction->setToolTip(tr("Download notes from Git repo")); connect(downloadAction, &QAction::triggered, this, &VMainWindow::download); m_syncMenu->addAction(downloadAction); } @@ -1018,9 +1018,9 @@ void VMainWindow::upload() { QString notebookDir = (*i)->getPath(); QString notebookName = (*i)->getName(); - if ((*i)->isOpened()) - { - qDebug() << "notebook name: " << notebookName << "notebook path: " << notebookDir; + if ((*i)->isOpened()) + { + qDebug() << "notebook name: " << notebookName << "notebook path: " << notebookDir; int ret = VUtils::showMessage(QMessageBox::Information, tr("Information"), tr("Are you sure to close opened notes"), tr("VNote will close all the opened notes before upload."), @@ -1040,9 +1040,9 @@ void VMainWindow::upload() return; } m_git->setDir(notebookDir); - m_git->upload(); - break; - } + m_git->upload(); + break; + } } }