1
0
Эх сурвалжийг харах

VSync: add support for linux/mac

Le Tan 5 жил өмнө
parent
commit
36e335bd72
2 өөрчлөгдсөн 15 нэмэгдсэн , 11 устгасан
  1. 4 0
      src/utils/vSync.cpp
  2. 11 11
      src/vmainwindow.cpp

+ 4 - 0
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();
 }
 

+ 11 - 11
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;
+        }
     }
 }