Mercurial > hg > easyhg
changeset 640:91b7ad45c608
Merge
author | Chris Cannam |
---|---|
date | Fri, 19 Oct 2012 11:47:28 +0100 |
parents | 31f5168fb5d9 (diff) 66adbedb69a9 (current diff) |
children | b29b9694cd0d |
files | src/mainwindow.cpp |
diffstat | 12 files changed, 130 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/easyhg.pro Fri Oct 19 11:25:02 2012 +0100 +++ b/easyhg.pro Fri Oct 19 11:47:28 2012 +0100 @@ -145,7 +145,7 @@ } win* { - LIBS += -lSecur32 + LIBS += -lSecur32 -lAdvapi32 } RESOURCES = easyhg.qrc
--- a/src/filestates.cpp Fri Oct 19 11:25:02 2012 +0100 +++ b/src/filestates.cpp Fri Oct 19 11:47:28 2012 +0100 @@ -161,11 +161,11 @@ switch (s) { case Modified: - a << Annotate << Diff << Commit << Revert << Rename << Copy << Remove; + a << Annotate << Diff << Commit << Revert << Rename << Copy << Remove << ShowIn; break; case Added: - a << Commit << Revert << Rename << Copy << Remove; + a << Commit << Revert << Rename << Copy << Remove << ShowIn; break; case Removed: @@ -173,7 +173,7 @@ break; case InConflict: - a << Annotate << Diff << RedoMerge << MarkResolved << Revert; + a << Annotate << Diff << RedoMerge << MarkResolved << Revert << ShowIn; break; case Missing: @@ -181,15 +181,15 @@ break; case Unknown: - a << Add << Ignore; + a << Add << Ignore << ShowIn; break; case Clean: - a << Annotate << Rename << Copy << Remove; + a << Annotate << Rename << Copy << Remove << ShowIn; break; case Ignored: - a << UnIgnore; + a << UnIgnore << ShowIn; break; } @@ -210,6 +210,7 @@ case Add: case Remove: return 3; case RedoMerge: case MarkResolved: return 4; case Ignore: case UnIgnore: return 5; + case ShowIn: return 6; } return 0; }
--- a/src/filestates.h Fri Oct 19 11:25:02 2012 +0100 +++ b/src/filestates.h Fri Oct 19 11:47:28 2012 +0100 @@ -77,6 +77,8 @@ Ignore, UnIgnore, + ShowIn, + FirstActivity = Diff, LastActivity = UnIgnore };
--- a/src/filestatuswidget.cpp Fri Oct 19 11:25:02 2012 +0100 +++ b/src/filestatuswidget.cpp Fri Oct 19 11:47:28 2012 +0100 @@ -72,6 +72,18 @@ // Unignore is too difficult in fact, so we just offer to edit the hgignore m_actionLabels[FileStates::UnIgnore] = tr("Edit .hgignore File"); + // No "show in" under Unix at the moment. +#if defined Q_OS_MAC + m_actionLabels[FileStates::ShowIn] = tr("Show in Finder"); +#elif defined Q_OS_WIN32 + m_actionLabels[FileStates::ShowIn] = tr("Show in Windows Explorer"); +#endif + + m_shortcuts[FileStates::ShowIn] = tr("Ctrl+Shift+S"); + m_shortcuts[FileStates::Diff] = tr("Ctrl+Shift+D"); + m_shortcuts[FileStates::Commit] = tr("Ctrl+Shift+C"); + m_shortcuts[FileStates::Revert] = tr("Ctrl+Shift+R"); + m_descriptions[FileStates::Clean] = tr("You have not changed these files."); m_descriptions[FileStates::Modified] = tr("You have changed these files since you last committed them."); m_descriptions[FileStates::Added] = tr("These files will be added to version control next time you commit them."); @@ -127,6 +139,11 @@ FileStates::Activities activities = m_fileStates.activitiesSupportedBy(s); int prevGroup = -1; foreach (FileStates::Activity a, activities) { + QString label = m_actionLabels[a]; + if (label.length() == 0) { + // Skip empty labels. + continue; + } int group = FileStates::activityGroup(a); if (group != prevGroup && prevGroup != -1) { QAction *sep = new QAction("", w); @@ -134,9 +151,14 @@ w->insertAction(0, sep); } prevGroup = group; - QAction *act = new QAction(m_actionLabels[a], w); + QAction *act = new QAction(label, w); act->setProperty("state", s); act->setProperty("activity", a); + if (m_shortcuts.contains(a)) { + QString shortcut = m_shortcuts[a]; + act->setShortcut(shortcut); + act->setShortcutContext(Qt::WidgetShortcut); + } connect(act, SIGNAL(triggered()), this, SLOT(menuActionActivated())); w->insertAction(0, act); } @@ -282,6 +304,7 @@ case FileStates::MarkResolved: emit markFilesResolved(files); break; case FileStates::Ignore: emit ignoreFiles(files); break; case FileStates::UnIgnore: emit unIgnoreFiles(files); break; + case FileStates::ShowIn: emit showIn(files); break; } }
--- a/src/filestatuswidget.h Fri Oct 19 11:25:02 2012 +0100 +++ b/src/filestatuswidget.h Fri Oct 19 11:47:28 2012 +0100 @@ -74,6 +74,7 @@ void markFilesResolved(QStringList); void ignoreFiles(QStringList); void unIgnoreFiles(QStringList); + void showIn(QStringList); public slots: void clearSelections(); @@ -99,6 +100,7 @@ QMap<FileStates::State, QString> m_descriptions; QMap<FileStates::State, QListWidget *> m_stateListMap; QMap<FileStates::Activity, QString> m_actionLabels; + QMap<FileStates::Activity, QString> m_shortcuts; QString m_highlightExplanation; QFileInfo *m_dateReference;
--- a/src/findwidget.cpp Fri Oct 19 11:25:02 2012 +0100 +++ b/src/findwidget.cpp Fri Oct 19 11:47:28 2012 +0100 @@ -33,6 +33,7 @@ layout->addWidget(button, 0, 0); button->setText(tr("Find...")); button->setToolButtonStyle(Qt::ToolButtonTextOnly); + button->setShortcut(tr("Ctrl+F")); connect(button, SIGNAL(clicked()), this, SLOT(buttonPressed())); m_lineEdit = new QLineEdit(); @@ -59,15 +60,15 @@ QAbstractButton *button = qobject_cast<QAbstractButton *>(sender()); if (!button) return; if (m_lineEdit->isVisible()) { - m_lineEdit->hide(); - button->setText(tr("Find...")); + m_lineEdit->hide(); + button->setText(tr("Find...")); if (m_lineEdit->text() != "") { emit findTextChanged(""); } } else { - m_lineEdit->show(); + m_lineEdit->show(); m_lineEdit->setFocus(Qt::OtherFocusReason); - button->setText(tr("Find:")); + button->setText(tr("Find:")); if (m_lineEdit->text() != "") { emit findTextChanged(m_lineEdit->text()); }
--- a/src/hgtabwidget.cpp Fri Oct 19 11:25:02 2012 +0100 +++ b/src/hgtabwidget.cpp Fri Oct 19 11:47:28 2012 +0100 @@ -23,6 +23,7 @@ #include <QClipboard> #include <QContextMenuEvent> #include <QApplication> +#include <QSettings> #include <iostream> @@ -77,6 +78,9 @@ connect(m_fileStatusWidget, SIGNAL(unIgnoreFiles(QStringList)), this, SIGNAL(unIgnoreFiles(QStringList))); + connect(m_fileStatusWidget, SIGNAL(showIn(QStringList)), + this, SIGNAL(showIn(QStringList))); + addTab(m_fileStatusWidget, tr("My work")); // History graph tab @@ -278,7 +282,11 @@ { m_historyWidget->parseIncrementalLog(hgLogList); if (m_historyWidget->haveNewItems()) { - showHistoryTab(); + QSettings settings; + settings.beginGroup("Presentation"); + if (settings.value("showHistoryAutomatically", true).toBool()) { + showHistoryTab(); + } } }
--- a/src/hgtabwidget.h Fri Oct 19 11:25:02 2012 +0100 +++ b/src/hgtabwidget.h Fri Oct 19 11:47:28 2012 +0100 @@ -108,6 +108,7 @@ void markFilesResolved(QStringList); void ignoreFiles(QStringList); void unIgnoreFiles(QStringList); + void showIn(QStringList); public slots: void clearSelections();
--- a/src/mainwindow.cpp Fri Oct 19 11:25:02 2012 +0100 +++ b/src/mainwindow.cpp Fri Oct 19 11:47:28 2012 +0100 @@ -857,6 +857,33 @@ hgEditIgnore(); } +void MainWindow::hgShowIn(QStringList files) +{ + foreach (QString file, files) + { + QStringList args; +#if defined Q_OS_WIN32 + // Although the Win32 API is quite happy to have + // forward slashes as directory separators, Windows + // Explorer is not + int last = m_workFolderPath.length() - 1; + char c = m_workFolderPath[last].toAscii(); + if (c == '\\' || c == '/') { + m_workFolderPath.chop(1); + } + file = m_workFolderPath + "\\" + file; + file = file.replace('/', '\\'); + args << "/select," << file; + // FIXME: This shouldn't be using a hardcoded path. + QProcess::execute("c:/windows/explorer.exe", args); +#elif defined(Q_OS_MAC) + file = m_workFolderPath + "/" + file; + args << "--reveal" << file; + QProcess::execute("/usr/bin/open", args); +#endif + } +} + QString MainWindow::getDiffBinaryName() { QSettings settings; @@ -895,11 +922,20 @@ // Diff parent against working folder (folder diff) params << "--config" << "extensions.extdiff=" << "extdiff"; - params << "--program" << diff; - - params << "--" << files; // may be none: whole dir - - m_runner->requestAction(HgAction(ACT_FOLDERDIFF, m_workFolderPath, params)); + params << "--program" << diff << "--"; + + QSettings settings; + if (settings.value("multipleDiffInstances", false).toBool()) { + foreach (QString file, files) { + QStringList p = params; + p << file; + m_runner->requestAction(HgAction(ACT_FOLDERDIFF, m_workFolderPath, p)); + } + } + else { + params << files; // may be none: whole dir + m_runner->requestAction(HgAction(ACT_FOLDERDIFF, m_workFolderPath, params)); + } } void MainWindow::hgDiffToCurrent(QString id) @@ -2670,6 +2706,9 @@ connect(m_hgTabs, SIGNAL(unIgnoreFiles(QStringList)), this, SLOT(hgUnIgnoreFiles(QStringList))); + + connect(m_hgTabs, SIGNAL(showIn(QStringList)), + this, SLOT(hgShowIn(QStringList))); } void MainWindow::enableDisableActions()
--- a/src/mainwindow.h Fri Oct 19 11:25:02 2012 +0100 +++ b/src/mainwindow.h Fri Oct 19 11:47:28 2012 +0100 @@ -114,6 +114,7 @@ void hgMarkFilesResolved(QStringList); void hgIgnoreFiles(QStringList); void hgUnIgnoreFiles(QStringList); + void hgShowIn(QStringList); void updateFsWatcher(); void checkFilesystem();
--- a/src/settingsdialog.cpp Fri Oct 19 11:25:02 2012 +0100 +++ b/src/settingsdialog.cpp Fri Oct 19 11:47:28 2012 +0100 @@ -87,6 +87,9 @@ m_showExtraText = new QCheckBox(tr("Show long descriptions for file status headings")); lookLayout->addWidget(m_showExtraText, row++, 0, 1, 2); + m_showHistoryAutomatically = new QCheckBox(tr("Switch to history tab automatically when history changes")); + lookLayout->addWidget(m_showHistoryAutomatically, row++, 0, 1, 2); + #ifdef NOT_IMPLEMENTED_YET lookLayout->addWidget(new QLabel(tr("Place the work and history views")), row, 0); m_workHistoryArrangement = new QComboBox(); @@ -138,7 +141,10 @@ browse = new QPushButton(tr("Browse...")); pathsLayout->addWidget(browse, row++, 1); connect(browse, SIGNAL(clicked()), this, SLOT(diffPathBrowse())); - + + m_multipleDiffInstances = new QCheckBox(tr("Multiple instances when multiple files are selected")); + pathsLayout->addWidget(m_multipleDiffInstances, row++, 2); + pathsLayout->addWidget(new QLabel(tr("External file-merge program:")), row, 0); m_mergePathLabel = new QLineEdit(); @@ -157,20 +163,20 @@ pathsLayout->addWidget(browse, row++, 1); connect(browse, SIGNAL(clicked()), this, SLOT(sshPathBrowse())); - pathsLayout->addWidget(new QLabel(tr("EasyHg Mercurial extension:")), row, 0); + //!!! more info plz + m_useExtension = new QCheckBox(tr("Use EasyHg Mercurial extension")); + pathsLayout->addWidget(m_useExtension, row, 0); + connect(m_useExtension, SIGNAL(stateChanged(int)), this, SLOT(useExtension(int))); m_extensionPathLabel = new QLineEdit(); pathsLayout->addWidget(m_extensionPathLabel, row, 2); - browse = new QPushButton(tr("Browse...")); - pathsLayout->addWidget(browse, row++, 1); - connect(browse, SIGNAL(clicked()), this, SLOT(extensionPathBrowse())); - - //!!! more info plz - m_useExtension = new QCheckBox(tr("Use EasyHg Mercurial extension")); - pathsLayout->addWidget(m_useExtension, row++, 2); + m_extensionBrowse = new QPushButton(tr("Browse...")); + pathsLayout->addWidget(m_extensionBrowse, row++, 1); + connect(m_extensionBrowse, SIGNAL(clicked()), this, SLOT(extensionPathBrowse())); pathsLayout->setRowStretch(row, 20); + pathsLayout->setColumnStretch(2, 20); reset(); // loads current defaults from settings @@ -225,6 +231,13 @@ } void +SettingsDialog::useExtension(int) +{ + m_extensionPathLabel->setEnabled(m_useExtension->isChecked()); + m_extensionBrowse->setEnabled(m_useExtension->isChecked()); +} + +void SettingsDialog::browseFor(QString title, QLineEdit *edit) { QString origin = edit->text(); @@ -407,6 +420,7 @@ settings.beginGroup("Presentation"); settings.remove("showiconlabels"); settings.remove("showhelpfultext"); + settings.remove("showHistoryAutomatically"); settings.remove("dateformat"); settings.endGroup(); settings.beginGroup("Locations"); @@ -418,6 +432,7 @@ settings.endGroup(); settings.beginGroup(""); settings.remove("useextension"); + settings.remove("multipleDiffInstances"); settings.endGroup(); } @@ -433,6 +448,7 @@ settings.beginGroup("Presentation"); m_showIconLabels->setChecked(settings.value("showiconlabels", true).toBool()); m_showExtraText->setChecked(settings.value("showhelpfultext", true).toBool()); + m_showHistoryAutomatically->setChecked(settings.value("showHistoryAutomatically", true).toBool()); #ifdef NOT_IMPLEMENTED_YET m_workHistoryArrangement->setCurrentIndex(settings.value("workhistoryarrangement", 0).toInt()); #endif @@ -448,6 +464,8 @@ settings.endGroup(); settings.beginGroup(""); m_useExtension->setChecked(settings.value("useextension", true).toBool()); + useExtension(m_useExtension->isChecked()); + m_multipleDiffInstances->setChecked(settings.value("multipleDiffInstances", false).toBool()); settings.endGroup(); } @@ -472,6 +490,7 @@ settings.setValue("showhelpfultext", b); m_presentationChanged = true; } + settings.setValue("showHistoryAutomatically", m_showHistoryAutomatically->isChecked()); int i; #ifdef NOT_IMPLEMENTED_YET i = m_workHistoryArrangement->currentIndex(); @@ -500,6 +519,7 @@ settings.endGroup(); settings.beginGroup(""); settings.setValue("useextension", m_useExtension->isChecked()); + settings.setValue("multipleDiffInstances", m_multipleDiffInstances->isChecked()); settings.endGroup(); QDialog::accept(); }
--- a/src/settingsdialog.h Fri Oct 19 11:25:02 2012 +0100 +++ b/src/settingsdialog.h Fri Oct 19 11:47:28 2012 +0100 @@ -55,6 +55,7 @@ void mergePathBrowse(); void sshPathBrowse(); void extensionPathBrowse(); + void useExtension(int); void accept(); void reset(); @@ -71,11 +72,15 @@ QLineEdit *m_mergePathLabel; QLineEdit *m_sshPathLabel; + QPushButton *m_extensionBrowse; + + QCheckBox *m_multipleDiffInstances; QCheckBox *m_useExtension; QLineEdit *m_extensionPathLabel; QCheckBox *m_showIconLabels; QCheckBox *m_showExtraText; + QCheckBox *m_showHistoryAutomatically; QComboBox *m_dateFormat; QDateEdit *m_dateFrom;