comparison src/mainwindow.cpp @ 425:ad106f5fe75f

Add "Ignore Files" and "Edit Ignored List" to Work menu (latter is subsumed from Advanced menu formerly). Also subsume Serve via HTTP into File menu as Share Repository, and add a more helpful description of it. Remove Advanced menu
author Chris Cannam
date Thu, 23 Jun 2011 10:58:32 +0100
parents 06e5c4f3dd7c
children 6a9756700fd1
comparison
equal deleted inserted replaced
424:d4da9c0809ac 425:ad106f5fe75f
560 delete ts; 560 delete ts;
561 f.close(); 561 f.close();
562 } 562 }
563 } 563 }
564 564
565 void MainWindow::hgIgnore()
566 {
567 // hgExplorer permitted adding "all" files -- I'm not sure
568 // that one is a good idea, let's require the user to select
569
570 hgIgnoreFiles(m_hgTabs->getSelectedAddableFiles());
571 }
572
565 void MainWindow::hgEditIgnore() 573 void MainWindow::hgEditIgnore()
566 { 574 {
567 if (!QDir(m_workFolderPath).exists()) return; 575 if (!QDir(m_workFolderPath).exists()) return;
568 576
569 initHgIgnore(); 577 initHgIgnore();
1244 } 1252 }
1245 1253
1246 //!!! should find available port as well 1254 //!!! should find available port as well
1247 1255
1248 QTextStream ts(&msg); 1256 QTextStream ts(&msg);
1249 ts << QString("<qt><p>%1</p>") 1257 ts << QString("<qt><h3>%1</h3><p>%2</p><p>%3</p>")
1250 .arg(tr("Running temporary server at %n address(es):", "", addrs.size())); 1258 .arg(tr("Sharing Repository"))
1259 .arg(tr("Your local repository is now being made temporarily available via HTTP for workgroup access."))
1260 .arg(tr("Users who have network access to your computer can now clone your repository by using the following URL as a remote location:"));
1251 foreach (QString addr, addrs) { 1261 foreach (QString addr, addrs) {
1252 ts << QString("<pre>&nbsp;&nbsp;http://%1:8000</pre>").arg(xmlEncode(addr)); 1262 ts << QString("<pre>&nbsp;&nbsp;http://%1:8000</pre>").arg(xmlEncode(addr));
1253 } 1263 }
1254 ts << tr("<p>Press Close to stop the server and return.</p>"); 1264 ts << tr("<p>Press Close to terminate this server, end remote access, and return.</p>");
1255 ts.flush(); 1265 ts.flush();
1256 1266
1257 params << "serve"; 1267 params << "serve";
1258 1268
1259 m_runner->requestAction(HgAction(ACT_SERVE, m_workFolderPath, params)); 1269 m_runner->requestAction(HgAction(ACT_SERVE, m_workFolderPath, params));
1260 1270
1261 QMessageBox::information(this, tr("Serve"), msg, QMessageBox::Close); 1271 QMessageBox::information(this, tr("Share Repository"), msg, QMessageBox::Close);
1262 1272
1263 m_runner->killCurrentActions(); 1273 m_runner->killCurrentActions();
1264 } 1274 }
1265 1275
1266 void MainWindow::startupDialog() 1276 void MainWindow::startupDialog()
2486 2496
2487 connect(m_hgRefreshAct, SIGNAL(triggered()), this, SLOT(hgRefresh())); 2497 connect(m_hgRefreshAct, SIGNAL(triggered()), this, SLOT(hgRefresh()));
2488 connect(m_hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove())); 2498 connect(m_hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove()));
2489 connect(m_hgAddAct, SIGNAL(triggered()), this, SLOT(hgAdd())); 2499 connect(m_hgAddAct, SIGNAL(triggered()), this, SLOT(hgAdd()));
2490 connect(m_hgCommitAct, SIGNAL(triggered()), this, SLOT(hgCommit())); 2500 connect(m_hgCommitAct, SIGNAL(triggered()), this, SLOT(hgCommit()));
2501 connect(m_hgIgnoreAct, SIGNAL(triggered()), this, SLOT(hgIgnore()));
2502 connect(m_hgEditIgnoreAct, SIGNAL(triggered()), this, SLOT(hgEditIgnore()));
2491 connect(m_hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff())); 2503 connect(m_hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff()));
2492 connect(m_hgUpdateAct, SIGNAL(triggered()), this, SLOT(hgUpdate())); 2504 connect(m_hgUpdateAct, SIGNAL(triggered()), this, SLOT(hgUpdate()));
2493 connect(m_hgRevertAct, SIGNAL(triggered()), this, SLOT(hgRevert())); 2505 connect(m_hgRevertAct, SIGNAL(triggered()), this, SLOT(hgRevert()));
2494 connect(m_hgMergeAct, SIGNAL(triggered()), this, SLOT(hgMerge())); 2506 connect(m_hgMergeAct, SIGNAL(triggered()), this, SLOT(hgMerge()));
2495 connect(m_hgEditIgnoreAct, SIGNAL(triggered()), this, SLOT(hgEditIgnore()));
2496 2507
2497 connect(m_settingsAct, SIGNAL(triggered()), this, SLOT(settings())); 2508 connect(m_settingsAct, SIGNAL(triggered()), this, SLOT(settings()));
2498 connect(m_openAct, SIGNAL(triggered()), this, SLOT(open())); 2509 connect(m_openAct, SIGNAL(triggered()), this, SLOT(open()));
2499 connect(m_changeRemoteRepoAct, SIGNAL(triggered()), this, SLOT(changeRemoteRepo())); 2510 connect(m_changeRemoteRepoAct, SIGNAL(triggered()), this, SLOT(changeRemoteRepo()));
2500 2511
2640 m_hgRefreshAct->setEnabled(m_localRepoActionsEnabled); 2651 m_hgRefreshAct->setEnabled(m_localRepoActionsEnabled);
2641 m_hgFolderDiffAct->setEnabled(m_localRepoActionsEnabled && haveDiff); 2652 m_hgFolderDiffAct->setEnabled(m_localRepoActionsEnabled && haveDiff);
2642 m_hgRevertAct->setEnabled(m_localRepoActionsEnabled); 2653 m_hgRevertAct->setEnabled(m_localRepoActionsEnabled);
2643 m_hgAddAct->setEnabled(m_localRepoActionsEnabled); 2654 m_hgAddAct->setEnabled(m_localRepoActionsEnabled);
2644 m_hgRemoveAct->setEnabled(m_localRepoActionsEnabled); 2655 m_hgRemoveAct->setEnabled(m_localRepoActionsEnabled);
2656 m_hgIgnoreAct->setEnabled(m_localRepoActionsEnabled);
2645 m_hgUpdateAct->setEnabled(m_localRepoActionsEnabled); 2657 m_hgUpdateAct->setEnabled(m_localRepoActionsEnabled);
2646 m_hgCommitAct->setEnabled(m_localRepoActionsEnabled); 2658 m_hgCommitAct->setEnabled(m_localRepoActionsEnabled);
2647 m_hgMergeAct->setEnabled(m_localRepoActionsEnabled); 2659 m_hgMergeAct->setEnabled(m_localRepoActionsEnabled);
2648 m_hgServeAct->setEnabled(m_localRepoActionsEnabled); 2660 m_hgServeAct->setEnabled(m_localRepoActionsEnabled);
2649 m_hgEditIgnoreAct->setEnabled(m_localRepoActionsEnabled); 2661 m_hgEditIgnoreAct->setEnabled(m_localRepoActionsEnabled);
2654 m_hgAddAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canAdd()); 2666 m_hgAddAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canAdd());
2655 m_hgRemoveAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canRemove()); 2667 m_hgRemoveAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canRemove());
2656 m_hgCommitAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canCommit()); 2668 m_hgCommitAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canCommit());
2657 m_hgRevertAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canRevert()); 2669 m_hgRevertAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canRevert());
2658 m_hgFolderDiffAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canDiff()); 2670 m_hgFolderDiffAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canDiff());
2671 m_hgIgnoreAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canIgnore());
2659 2672
2660 // A default merge makes sense if: 2673 // A default merge makes sense if:
2661 // * there is only one parent (if there are two, we have an uncommitted merge) and 2674 // * there is only one parent (if there are two, we have an uncommitted merge) and
2662 // * there are exactly two heads that have the same branch as the current branch and 2675 // * there are exactly two heads that have the same branch as the current branch and
2663 // * our parent is one of those heads 2676 // * our parent is one of those heads
2846 m_hgRemoveAct = new QAction(QIcon(":/images/remove.png"), tr("&Remove Files"), this); 2859 m_hgRemoveAct = new QAction(QIcon(":/images/remove.png"), tr("&Remove Files"), this);
2847 m_hgRemoveAct->setIconText(tr("Remove")); 2860 m_hgRemoveAct->setIconText(tr("Remove"));
2848 m_hgRemoveAct->setShortcut(tr("Del")); 2861 m_hgRemoveAct->setShortcut(tr("Del"));
2849 m_hgRemoveAct->setStatusTip(tr("Mark the selected files to be removed from version control on the next commit")); 2862 m_hgRemoveAct->setStatusTip(tr("Mark the selected files to be removed from version control on the next commit"));
2850 2863
2864 m_hgIgnoreAct = new QAction(tr("&Ignore Files..."), this);
2865 m_hgIgnoreAct->setStatusTip(tr("Add the selected filenames to the ignored list, of files that should never be tracked in this repository"));
2866
2867 m_hgEditIgnoreAct = new QAction(tr("Edit Ignored List"), this);
2868 m_hgEditIgnoreAct->setStatusTip(tr("Edit the .hgignore file, containing the names of files that should be ignored by Mercurial"));
2869
2851 m_hgUpdateAct = new QAction(QIcon(":/images/update.png"), tr("&Update to Branch Head"), this); 2870 m_hgUpdateAct = new QAction(QIcon(":/images/update.png"), tr("&Update to Branch Head"), this);
2852 m_hgUpdateAct->setIconText(tr("Update")); 2871 m_hgUpdateAct->setIconText(tr("Update"));
2853 m_hgUpdateAct->setShortcut(tr("Ctrl+U")); 2872 m_hgUpdateAct->setShortcut(tr("Ctrl+U"));
2854 m_hgUpdateAct->setStatusTip(tr("Update the working folder to the head of the current repository branch")); 2873 m_hgUpdateAct->setStatusTip(tr("Update the working folder to the head of the current repository branch"));
2855 2874
2859 2878
2860 m_hgMergeAct = new QAction(QIcon(":/images/merge.png"), tr("&Merge"), this); 2879 m_hgMergeAct = new QAction(QIcon(":/images/merge.png"), tr("&Merge"), this);
2861 m_hgMergeAct->setShortcut(tr("Ctrl+M")); 2880 m_hgMergeAct->setShortcut(tr("Ctrl+M"));
2862 m_hgMergeAct->setStatusTip(tr("Merge the two independent sets of changes in the local repository into the working folder")); 2881 m_hgMergeAct->setStatusTip(tr("Merge the two independent sets of changes in the local repository into the working folder"));
2863 2882
2864 //Advanced actions 2883 m_hgServeAct = new QAction(tr("Share Repository"), this);
2865 2884 m_hgServeAct->setStatusTip(tr("Serve local repository temporarily via HTTP for workgroup access"));
2866 m_hgEditIgnoreAct = new QAction(tr("Edit .hgignore File"), this);
2867 m_hgEditIgnoreAct->setStatusTip(tr("Edit the .hgignore file, containing the names of files that should be ignored by Mercurial"));
2868
2869 m_hgServeAct = new QAction(tr("Serve via HTTP"), this);
2870 m_hgServeAct->setStatusTip(tr("Serve local repository via http for workgroup access"));
2871 2885
2872 //Help actions 2886 //Help actions
2873 m_aboutAct = new QAction(tr("About EasyMercurial"), this); 2887 m_aboutAct = new QAction(tr("About EasyMercurial"), this);
2874 2888
2875 // Miscellaneous 2889 // Miscellaneous
2883 m_fileMenu = menuBar()->addMenu(tr("&File")); 2897 m_fileMenu = menuBar()->addMenu(tr("&File"));
2884 2898
2885 m_fileMenu->addAction(m_openAct); 2899 m_fileMenu->addAction(m_openAct);
2886 m_recentMenu = m_fileMenu->addMenu(tr("Open Re&cent")); 2900 m_recentMenu = m_fileMenu->addMenu(tr("Open Re&cent"));
2887 m_fileMenu->addAction(m_hgRefreshAct); 2901 m_fileMenu->addAction(m_hgRefreshAct);
2902 m_fileMenu->addSeparator();
2903 m_fileMenu->addAction(m_hgServeAct);
2888 m_fileMenu->addSeparator(); 2904 m_fileMenu->addSeparator();
2889 m_fileMenu->addAction(m_settingsAct); 2905 m_fileMenu->addAction(m_settingsAct);
2890 m_fileMenu->addSeparator(); 2906 m_fileMenu->addSeparator();
2891 m_fileMenu->addAction(m_exitAct); 2907 m_fileMenu->addAction(m_exitAct);
2892 2908
2899 workMenu->addAction(m_hgMergeAct); 2915 workMenu->addAction(m_hgMergeAct);
2900 workMenu->addSeparator(); 2916 workMenu->addSeparator();
2901 workMenu->addAction(m_hgAddAct); 2917 workMenu->addAction(m_hgAddAct);
2902 workMenu->addAction(m_hgRemoveAct); 2918 workMenu->addAction(m_hgRemoveAct);
2903 workMenu->addSeparator(); 2919 workMenu->addSeparator();
2920 workMenu->addAction(m_hgIgnoreAct);
2921 workMenu->addAction(m_hgEditIgnoreAct);
2922 workMenu->addSeparator();
2904 workMenu->addAction(m_hgRevertAct); 2923 workMenu->addAction(m_hgRevertAct);
2905 2924
2906 QMenu *remoteMenu; 2925 QMenu *remoteMenu;
2907 remoteMenu = menuBar()->addMenu(tr("&Remote")); 2926 remoteMenu = menuBar()->addMenu(tr("&Remote"));
2927 remoteMenu->addAction(m_changeRemoteRepoAct);
2928 remoteMenu->addSeparator();
2908 remoteMenu->addAction(m_hgIncomingAct); 2929 remoteMenu->addAction(m_hgIncomingAct);
2909 remoteMenu->addSeparator(); 2930 remoteMenu->addSeparator();
2910 remoteMenu->addAction(m_hgPullAct); 2931 remoteMenu->addAction(m_hgPullAct);
2911 remoteMenu->addAction(m_hgPushAct); 2932 remoteMenu->addAction(m_hgPushAct);
2912 remoteMenu->addSeparator();
2913 remoteMenu->addAction(m_changeRemoteRepoAct);
2914
2915 m_advancedMenu = menuBar()->addMenu(tr("&Advanced"));
2916 m_advancedMenu->addAction(m_hgEditIgnoreAct);
2917 m_advancedMenu->addSeparator();
2918 m_advancedMenu->addAction(m_hgServeAct);
2919 2933
2920 m_helpMenu = menuBar()->addMenu(tr("&Help")); 2934 m_helpMenu = menuBar()->addMenu(tr("&Help"));
2921 m_helpMenu->addAction(m_aboutAct); 2935 m_helpMenu->addAction(m_aboutAct);
2922 } 2936 }
2923 2937