comparison src/mainwindow.cpp @ 491:1d90cd7a1c5f

Add tester for newer version
author Chris Cannam
date Thu, 18 Aug 2011 13:15:38 +0100
parents 86cdaa346e59
children 41a156d439d0
comparison
equal deleted inserted replaced
489:86cdaa346e59 491:1d90cd7a1c5f
48 #include "moreinformationdialog.h" 48 #include "moreinformationdialog.h"
49 #include "annotatedialog.h" 49 #include "annotatedialog.h"
50 #include "version.h" 50 #include "version.h"
51 #include "workstatuswidget.h" 51 #include "workstatuswidget.h"
52 #include "hgignoredialog.h" 52 #include "hgignoredialog.h"
53 #include "versiontester.h"
53 54
54 55
55 MainWindow::MainWindow(QString myDirPath) : 56 MainWindow::MainWindow(QString myDirPath) :
56 m_myDirPath(myDirPath), 57 m_myDirPath(myDirPath),
57 m_fsWatcherGeneralTimer(0), 58 m_fsWatcherGeneralTimer(0),
128 ColourSet *cs = ColourSet::instance(); 129 ColourSet *cs = ColourSet::instance();
129 cs->clearDefaultNames(); 130 cs->clearDefaultNames();
130 cs->addDefaultName(""); 131 cs->addDefaultName("");
131 cs->addDefaultName("default"); 132 cs->addDefaultName("default");
132 cs->addDefaultName(getUserInfo()); 133 cs->addDefaultName(getUserInfo());
134
135 VersionTester *vt = new VersionTester
136 ("easymercurial.org", "/latest-version.txt", EASYHG_VERSION);
137 connect(vt, SIGNAL(newerVersionAvailable(QString)),
138 this, SLOT(newerVersionAvailable(QString)));
133 139
134 hgTest(); 140 hgTest();
135 updateRecentMenu(); 141 updateRecentMenu();
136 } 142 }
137 143
3060 settings.setValue("remoterepopath", m_remoteRepoPath); 3066 settings.setValue("remoterepopath", m_remoteRepoPath);
3061 settings.setValue("workfolderpath", m_workFolderPath); 3067 settings.setValue("workfolderpath", m_workFolderPath);
3062 settings.setValue("firststart", m_firstStart); 3068 settings.setValue("firststart", m_firstStart);
3063 } 3069 }
3064 3070
3065 3071 void MainWindow::newerVersionAvailable(QString version)
3066 3072 {
3067 3073 QSettings settings;
3074 settings.beginGroup("NewerVersionWarning");
3075 QString tag = QString("version-%1-available-show").arg(version);
3076 if (settings.value(tag, true).toBool()) {
3077 QString title(tr("Newer version available"));
3078 QString text(tr("<h3>Newer version available</h3><p>You are using version %1 of EasyMercurial, but version %3 is now available.</p><p>Please see the <a href=\"http://easymercurial.org/\">EasyMercurial website</a> for more information.</p>").arg(EASYHG_VERSION).arg(version));
3079 QMessageBox::information(this, title, text);
3080 settings.setValue(tag, false);
3081 }
3082 settings.endGroup();
3083 }
3084