From d8be482cf680f99e5caaa3d91ff5841f6c541b4b Mon Sep 17 00:00:00 2001 From: Cyp Date: Tue, 19 Jan 2010 17:44:36 +0100 Subject: [PATCH] Add "GNU source-highlight not installed" to Source highlight button tooltip, if not installed. And add the version, if it is installed. This way, the tooltip explains why the button is disabled. Signed-off-by: Marco Costalba --- src/fileview.cpp | 4 ++++ src/fileview.ui | 2 +- src/git.cpp | 4 +++- src/git.h | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/fileview.cpp b/src/fileview.cpp index 4f8e1a8..beafce8 100644 --- a/src/fileview.cpp +++ b/src/fileview.cpp @@ -26,6 +26,10 @@ FileView::FileView(MainImpl* mi, Git* g) : Domain(mi, g, false) { // an empty string turn off the special-value text display fileTab->spinBoxRevision->setSpecialValueText(" "); + // Add GNU source-highlight version to tooltip, or add a message that it's not installed. + QToolButton* highlight = fileTab->toolButtonHighlightText; + highlight->setToolTip(highlight->toolTip().arg(git->textHighlighterVersion())); + clear(true); // init some stuff fileTab->listWidgetAnn->installEventFilter(this); diff --git a/src/fileview.ui b/src/fileview.ui index ab078bc..3069c70 100644 --- a/src/fileview.ui +++ b/src/fileview.ui @@ -206,7 +206,7 @@ - Source highlight + Source highlight (%1) :/icons/resources/colorize.png diff --git a/src/git.cpp b/src/git.cpp index 177b24a..50e6dd3 100644 --- a/src/git.cpp +++ b/src/git.cpp @@ -330,7 +330,9 @@ void Git::checkEnvironment() { isTextHighlighterFound = run("source-highlight -V", &version); errorReportingEnabled = true; if (isTextHighlighterFound) - dbp("Found %1", version.section('\n', 0, 0)); + textHighlighterVersionFound = version.section('\n', 0, 0); + else + textHighlighterVersionFound = "GNU source-highlight not installed"; } void Git::userInfo(SList info) { diff --git a/src/git.h b/src/git.h index f50cc81..0cb7e90 100644 --- a/src/git.h +++ b/src/git.h @@ -154,6 +154,7 @@ public: bool isNothingToCommit(); bool isUnknownFiles() const { return (workingDirInfo.otherFiles.count() > 0); } bool isTextHighlighter() const { return isTextHighlighterFound; } + const QString textHighlighterVersion() const { return textHighlighterVersionFound; } bool isMainHistory(const FileHistory* fh) { return (fh == revData); } MyProcess* getDiff(SCRef sha, QObject* receiver, SCRef diffToSha, bool combined); const QString getWorkDirDiff(SCRef fileName = ""); @@ -329,6 +330,7 @@ private: bool isStGIT; bool isGIT; bool isTextHighlighterFound; + QString textHighlighterVersionFound; bool loadingUnAppliedPatches; bool fileCacheAccessed; int patchesStillToFind; -- 2.11.4.GIT