Mercurial > hg > easyhg
comparison mainwindow.cpp @ 178:1a3af8617ea4
* basic external editor selection (for hgignore)
author | Chris Cannam |
---|---|
date | Thu, 16 Dec 2010 22:11:38 +0000 |
parents | bb89bcd8986b |
children | a51980a00dac |
comparison
equal
deleted
inserted
replaced
177:bb89bcd8986b | 178:1a3af8617ea4 |
---|---|
374 | 374 |
375 void MainWindow::hgIgnore() | 375 void MainWindow::hgIgnore() |
376 { | 376 { |
377 QString hgIgnorePath; | 377 QString hgIgnorePath; |
378 QStringList params; | 378 QStringList params; |
379 QString editorName; | 379 |
380 | |
381 hgIgnorePath = workFolderPath; | 380 hgIgnorePath = workFolderPath; |
382 hgIgnorePath += ".hgignore"; | 381 hgIgnorePath += "/.hgignore"; |
383 | 382 |
384 params << hgIgnorePath; | 383 params << hgIgnorePath; |
385 | 384 |
386 //!!! | 385 QSettings settings; |
387 #ifdef Q_OS_LINUX | 386 settings.beginGroup("Locations"); |
388 | 387 QString editor = settings.value("editorbinary", "").toString(); |
389 editorName = "gedit"; | 388 if (editor == "") { |
390 | 389 QStringList bases; |
390 bases | |
391 #if defined Q_OS_WIN32 | |
392 << "wordpad.exe" | |
393 << "C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe" | |
394 << "notepad.exe" | |
395 #elif defined Q_OS_MAC | |
396 << "textedit" | |
391 #else | 397 #else |
392 | 398 << "gedit" << "kate" |
393 editorName = """C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe"""; | |
394 | |
395 #endif | 399 #endif |
400 ; | |
401 bool found = false; | |
402 foreach (QString base, bases) { | |
403 editor = findInPath(base, m_myDirPath, true); | |
404 if (editor != base && editor != base + ".exe") { | |
405 found = true; | |
406 break; | |
407 } | |
408 } | |
409 if (found) { | |
410 settings.setValue("editorbinary", editor); | |
411 } else { | |
412 editor = ""; | |
413 } | |
414 } | |
415 | |
416 if (editor == "") { | |
417 DEBUG << "Failed to find a text editor" << endl; | |
418 //!!! visible error! | |
419 return; | |
420 } | |
396 | 421 |
397 HgAction action(ACT_HG_IGNORE, workFolderPath, params); | 422 HgAction action(ACT_HG_IGNORE, workFolderPath, params); |
398 action.executable = editorName; | 423 action.executable = editor; |
399 | 424 |
400 runner->requestAction(action); | 425 runner->requestAction(action); |
401 } | 426 } |
402 | 427 |
403 void MainWindow::findDiffBinaryName() | 428 void MainWindow::findDiffBinaryName() |
1827 exitAct->setShortcuts(QKeySequence::Quit); | 1852 exitAct->setShortcuts(QKeySequence::Quit); |
1828 exitAct->setStatusTip(tr("Quit EasyMercurial")); | 1853 exitAct->setStatusTip(tr("Quit EasyMercurial")); |
1829 | 1854 |
1830 //Repository actions | 1855 //Repository actions |
1831 hgRefreshAct = new QAction(QIcon(":/images/status.png"), tr("Refresh"), this); | 1856 hgRefreshAct = new QAction(QIcon(":/images/status.png"), tr("Refresh"), this); |
1832 hgRefreshAct->setStatusTip(tr("Update the window to show the current state of the working folder")); | 1857 hgRefreshAct->setStatusTip(tr("Refresh the window to show the current state of the working folder")); |
1833 | 1858 |
1834 hgIncomingAct = new QAction(QIcon(":/images/incoming.png"), tr("Preview"), this); | 1859 hgIncomingAct = new QAction(QIcon(":/images/incoming.png"), tr("Preview"), this); |
1835 hgIncomingAct -> setStatusTip(tr("See what changes are available in the remote repository waiting to be pulled")); | 1860 hgIncomingAct -> setStatusTip(tr("See what changes are available in the remote repository waiting to be pulled")); |
1836 | 1861 |
1837 hgPullAct = new QAction(QIcon(":/images/pull.png"), tr("Pull"), this); | 1862 hgPullAct = new QAction(QIcon(":/images/pull.png"), tr("Pull"), this); |