VSync: add support for linux/mac

This commit is contained in:
Le Tan 2020-09-04 20:25:55 +08:00
parent d3e1e560c4
commit 36e335bd72
2 changed files with 15 additions and 11 deletions

View File

@ -123,7 +123,11 @@ void VSync::onProcessFinish(int exitCode)
void VSync::start(const QString &cmd) void VSync::start(const QString &cmd)
{ {
#if defined(Q_OS_WIN)
m_process->start("cmd", QStringList() << "/c" << cmd); m_process->start("cmd", QStringList() << "/c" << cmd);
#else
m_process->start("/bin/sh", QStringList() << "-c" << cmd);
#endif
m_process->waitForStarted(); m_process->waitForStarted();
} }

View File

@ -998,15 +998,15 @@ void VMainWindow::initMarkdownMenu()
void VMainWindow::initSyncMenu() void VMainWindow::initSyncMenu()
{ {
m_syncMenu = menuBar()->addMenu(tr("&Sync")); m_syncMenu = menuBar()->addMenu(tr("Git &Sync"));
m_syncMenu->setToolTipsVisible(true); m_syncMenu->setToolTipsVisible(true);
QAction* uploadAction = new QAction(tr("&Upload"), this); QAction* uploadAction = new QAction(tr("&Upload"), this);
uploadAction->setToolTip(tr("upload note")); uploadAction->setToolTip(tr("Upload notes to Git repo"));
connect(uploadAction, &QAction::triggered, this, &VMainWindow::upload); connect(uploadAction, &QAction::triggered, this, &VMainWindow::upload);
m_syncMenu->addAction(uploadAction); m_syncMenu->addAction(uploadAction);
QAction* downloadAction = new QAction(tr("&Download"), this); 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); connect(downloadAction, &QAction::triggered, this, &VMainWindow::download);
m_syncMenu->addAction(downloadAction); m_syncMenu->addAction(downloadAction);
} }
@ -1018,9 +1018,9 @@ void VMainWindow::upload()
{ {
QString notebookDir = (*i)->getPath(); QString notebookDir = (*i)->getPath();
QString notebookName = (*i)->getName(); QString notebookName = (*i)->getName();
if ((*i)->isOpened()) if ((*i)->isOpened())
{ {
qDebug() << "notebook name: " << notebookName << "notebook path: " << notebookDir; qDebug() << "notebook name: " << notebookName << "notebook path: " << notebookDir;
int ret = VUtils::showMessage(QMessageBox::Information, tr("Information"), int ret = VUtils::showMessage(QMessageBox::Information, tr("Information"),
tr("Are you sure to close opened notes"), tr("Are you sure to close opened notes"),
tr("VNote will close all the opened notes before upload."), tr("VNote will close all the opened notes before upload."),
@ -1040,9 +1040,9 @@ void VMainWindow::upload()
return; return;
} }
m_git->setDir(notebookDir); m_git->setDir(notebookDir);
m_git->upload(); m_git->upload();
break; break;
} }
} }
} }