Updater and Version number changed to support for Release Number. Bumped version for updater test.

This commit is contained in:
Mark Watkins 2012-01-12 19:35:50 +10:00
parent 39b504c812
commit 9b0f992007
15 changed files with 138 additions and 32 deletions

View File

@ -42,5 +42,6 @@
<file>docs/script.js</file> <file>docs/script.js</file>
<file>icons/nographs.png</file> <file>icons/nographs.png</file>
<file>icons/sheep.png</file> <file>icons/sheep.png</file>
<file>docs/update_notes.html</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -60,6 +60,8 @@ const QString STR_GEN_DataFolder="DataFolder";
const QString STR_GEN_On=QObject::tr("On"); const QString STR_GEN_On=QObject::tr("On");
const QString STR_GEN_Off=QObject::tr("Off"); const QString STR_GEN_Off=QObject::tr("Off");
const QString STR_PREF_AllowEarlyUpdates="AllowEarlyUpdates";
const QString STR_PROP_Brand="Brand"; const QString STR_PROP_Brand="Brand";
const QString STR_PROP_Model="Model"; const QString STR_PROP_Model="Model";
const QString STR_PROP_ModelNumber="ModelNumber"; const QString STR_PROP_ModelNumber="ModelNumber";

View File

@ -602,7 +602,7 @@ bool PRS1Loader::Parse002v5(qint32 sequence, quint32 timestamp, unsigned char *b
EventList * TV=session->AddEventList(CPAP_TidalVolume,EVL_Event); EventList * TV=session->AddEventList(CPAP_TidalVolume,EVL_Event);
EventList * CA=NULL; //session->AddEventList(CPAP_ClearAirway, EVL_Event); EventList * CA=NULL; //session->AddEventList(CPAP_ClearAirway, EVL_Event);
EventList * VS=NULL, * VS2=NULL, * FL=NULL;//,* RE=NULL; EventList * VS=NULL, * FL=NULL;//,* RE=NULL,* VS2=NULL;
//EventList * PRESSURE=NULL; //EventList * PRESSURE=NULL;
//EventList * PP=NULL; //EventList * PP=NULL;

View File

@ -188,7 +188,8 @@ OTHER_FILES += \
docs/tooltips.css \ docs/tooltips.css \
docs/script.js \ docs/script.js \
update.xml \ update.xml \
docs/changelog.txt docs/changelog.txt \
docs/update_notes.html

View File

@ -171,6 +171,8 @@ void UpdaterWindow::ParseUpdateXML(QIODevice * dev)
QXmlInputSource src(dev); QXmlInputSource src(dev);
QXmlSimpleReader reader; QXmlSimpleReader reader;
reader.setContentHandler(&updateparser); reader.setContentHandler(&updateparser);
UpdateStatus AcceptUpdates=PREF[STR_PREF_AllowEarlyUpdates].toBool() ? UPDATE_TESTING : UPDATE_BETA;
if (reader.parse(src)) { if (reader.parse(src)) {
ui->plainTextEdit->appendPlainText(tr("XML update structure parsed cleanly")); ui->plainTextEdit->appendPlainText(tr("XML update structure parsed cleanly"));
@ -185,11 +187,13 @@ void UpdaterWindow::ParseUpdateXML(QIODevice * dev)
for (int i=versions.size()-1;i>=0;i--) { for (int i=versions.size()-1;i>=0;i--) {
QString verstr=versions[i]; QString verstr=versions[i];
release=&updateparser.releases[verstr]; release=&updateparser.releases[verstr];
if (release->updates.contains(platform)) { if (release->updates.contains(platform) // Valid Release?
&& (release->status >= AcceptUpdates)
&& (release->version >= VersionString)) {
break; break;
} else release=NULL; } else release=NULL;
} }
if (!release || (VersionString > release->version)) { if (!release) {
mainwin->Notify(tr("No updates were found for your platform."),tr("SleepyHead Updates"),5000); mainwin->Notify(tr("No updates were found for your platform."),tr("SleepyHead Updates"),5000);
PREF[STR_GEN_UpdatesLastChecked]=QDateTime::currentDateTime(); PREF[STR_GEN_UpdatesLastChecked]=QDateTime::currentDateTime();
close(); close();
@ -201,19 +205,24 @@ void UpdaterWindow::ParseUpdateXML(QIODevice * dev)
updates.clear(); updates.clear();
Update *upd=NULL; Update *upd=NULL;
Update *upq=NULL; Update *upq=NULL;
for (int i=0;i<release->updates[platform].size();i++) { for (int i=0;i<release->updates[platform].size();i++) {
update=&release->updates[platform][i]; update=&release->updates[platform][i];
if (update->type=="qtlibs") { if (update->type=="qtlibs") {
qDebug() << "QT Version" << update->version; qDebug() << "QT Version" << update->version;
if (update->version > latestqt) { if (update->version > latestqt) {
latestqt=update->version; if (update->status >= AcceptUpdates) {
upq=update; latestqt=update->version;
upq=update;
}
} }
} else if (update->type=="application") { } else if (update->type=="application") {
qDebug() << "Application Version" << update->version; qDebug() << "Application Version" << update->version;
if (update->version > latestapp) { if (update->version > latestapp) {
latestapp=update->version; if (update->status >= AcceptUpdates) {
upd=update; latestapp=update->version;
upd=update;
}
} }
} }
} }
@ -221,7 +230,7 @@ void UpdaterWindow::ParseUpdateXML(QIODevice * dev)
if (upq && (upq->version > QT_VERSION_STR)) { if (upq && (upq->version > QT_VERSION_STR)) {
updates.push_back(upq); updates.push_back(upq);
} }
if (upd && upd->version > VersionString) { if (upd && upd->version > FullVersionString) {
updates.push_back(upd); updates.push_back(upd);
} }
@ -234,11 +243,11 @@ void UpdaterWindow::ParseUpdateXML(QIODevice * dev)
QString info; QString info;
if (VersionString < release->version) { if (VersionString < release->version) {
ui->Title->setText("<font size=+1>"+tr("A new version of SleepyHead is available!")+"</font>"); ui->Title->setText("<font size=+1>"+tr("A new version of SleepyHead is available!")+"</font>");
info=tr("Shiny new <b>v%1</b> is available. You're running old and busted v%2").arg(latestapp).arg(VersionString); info=tr("Shiny new <b>v%1</b> is available. You're running old and busted v%2").arg(latestapp).arg(FullVersionString);
ui->notesTabWidget->setCurrentIndex(0); ui->notesTabWidget->setCurrentIndex(0);
} else { } else {
ui->Title->setText("<font size=+1>"+tr("An update for SleepyHead is available.")+"</font>"); ui->Title->setText("<font size=+1>"+tr("An update for SleepyHead is available.")+"</font>");
info=tr("Version <b>%1</b> is available. You're currently running v%1").arg(latestapp).arg(VersionString); info=tr("Version <b>%1</b> is available. You're currently running v%1").arg(latestapp).arg(FullVersionString);
ui->notesTabWidget->setCurrentIndex(1); ui->notesTabWidget->setCurrentIndex(1);
} }
ui->versionInfo->setText(info); ui->versionInfo->setText(info);
@ -246,7 +255,7 @@ void UpdaterWindow::ParseUpdateXML(QIODevice * dev)
QString notes; QString notes;
for (int i=0;i<release->updates[platform].size();i++) { for (int i=0;i<release->updates[platform].size();i++) {
update=&release->updates[platform][i]; update=&release->updates[platform][i];
if ((update->type=="application") && (update->version > VersionString)) { if ((update->type=="application") && (update->version > FullVersionString)) {
notes+="<b>"+tr("SleepyHead v%1 build notes").arg(update->version)+"</b><br/>"+update->notes.trimmed()+"<br/><br/>"; notes+="<b>"+tr("SleepyHead v%1 build notes").arg(update->version)+"</b><br/>"+update->notes.trimmed()+"<br/><br/>";
} else if ((update->type=="qtlibs") && (update->version > QT_VERSION_STR)) { } else if ((update->type=="qtlibs") && (update->version > QT_VERSION_STR)) {
notes+="<b>"+tr("Update to QtLibs (v%1)").arg(update->version)+"</b><br/>"+update->notes.trimmed(); notes+="<b>"+tr("Update to QtLibs (v%1)").arg(update->version)+"</b><br/>"+update->notes.trimmed();

19
docs/update_notes.html Normal file
View File

@ -0,0 +1,19 @@
<html>
<body>
<div align=center>
<h2><image src='qrc:/docs/sheep.png' width=64 height=64>SleepyHead <b>BETA</b></h2>
<h3><b>Update Notes</b></h3>
</div>
<b>Changes in this version</b><br/>
<list>
<li>Auto-Updater test for Windows & Mac Platforms</li>
<li>Adds Total Leaks Overview chart for PRS1 Users.</li>
<li>Preliminary ZEO CSV Support</li>
<li>Fixes Overview AHI chart showing "No Data" on 0.00 days.</li>
<li>Fixes crash after using Preferences before importing first data.</li>
</list>
<p>Have fun!</p>
<p>Mark Watkins (JediMark)</p>
</body>
</html>

View File

@ -79,6 +79,27 @@ void release_notes()
relnotes.exec(); relnotes.exec();
} }
void build_notes()
{
QDialog relnotes;
QVBoxLayout layout(&relnotes);
QWebView web(&relnotes);
relnotes.setWindowTitle("SleepyHead v"+FullVersionString+" Update");
// Language???
web.load(QUrl("qrc:/docs/update_notes.html"));
//web.page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOn);
relnotes.setLayout(&layout);
layout.insertWidget(0,&web,1);
QPushButton okbtn(QObject::tr("&Ok, get on with it.."),&relnotes);
relnotes.connect(&okbtn,SIGNAL(clicked()),SLOT(accept()));
layout.insertWidget(1,&okbtn,1);
layout.setMargin(0);
relnotes.setFixedSize(500,400);
relnotes.exec();
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#ifdef Q_WS_X11 #ifdef Q_WS_X11
@ -122,7 +143,7 @@ int main(int argc, char *argv[])
// Skip login screen, unless asked not to on the command line // Skip login screen, unless asked not to on the command line
bool skip_login=(PREF.ExistsAndTrue("SkipLoginScreen")); bool skip_login=PREF.ExistsAndTrue(STR_GEN_SkipLogin);
if (force_login_screen) skip_login=false; if (force_login_screen) skip_login=false;
// Todo: Make a wrapper for Preference settings, like Profile settings have.. // Todo: Make a wrapper for Preference settings, like Profile settings have..
@ -131,6 +152,9 @@ int main(int argc, char *argv[])
PREF[STR_GEN_UpdatesAutoCheck]=true; PREF[STR_GEN_UpdatesAutoCheck]=true;
PREF[STR_GEN_UpdateCheckFrequency]=7; PREF[STR_GEN_UpdateCheckFrequency]=7;
} }
if (!PREF.contains(STR_PREF_AllowEarlyUpdates)) {
PREF[STR_PREF_AllowEarlyUpdates]=false;
}
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// Check when last checked for updates.. // Check when last checked for updates..
@ -159,9 +183,16 @@ int main(int argc, char *argv[])
} else { } else {
if (PREF.contains("VersionString")) { if (PREF.contains("VersionString")) {
QString V=PREF["VersionString"].toString(); QString V=PREF["VersionString"].toString();
if (VersionString>V) {
release_notes(); if (FullVersionString>V) {
//QMessageBox::warning(0,"New Version Warning","This is a new version of SleepyHead. If you experience a crash right after clicking Ok, you will need to manually delete the "+AppRoot+" folder (it's located in your Documents folder) and reimport your data. After this things should work normally.",QMessageBox::Ok); QString V2=V.section("-",0,0);
if (VersionString>V2) {
release_notes();
//QMessageBox::warning(0,"New Version Warning","This is a new version of SleepyHead. If you experience a crash right after clicking Ok, you will need to manually delete the "+AppRoot+" folder (it's located in your Documents folder) and reimport your data. After this things should work normally.",QMessageBox::Ok);
} else {
build_notes();
}
check_updates=false; check_updates=false;
} }
} }
@ -179,7 +210,7 @@ int main(int argc, char *argv[])
} }
} }
} }
PREF["VersionString"]=VersionString; PREF["VersionString"]=FullVersionString;
p_profile=Profiles::Get(PREF[STR_GEN_Profile].toString()); p_profile=Profiles::Get(PREF[STR_GEN_Profile].toString());

View File

@ -77,7 +77,7 @@ MainWindow::MainWindow(QWidget *parent) :
logtime.start(); logtime.start();
ui->setupUi(this); ui->setupUi(this);
QString version=VersionString; QString version=FullVersionString;
if (QString(GIT_BRANCH)!="master") version+=QString(" ")+QString(GIT_BRANCH); if (QString(GIT_BRANCH)!="master") version+=QString(" ")+QString(GIT_BRANCH);
this->setWindowTitle(tr("SleepyHead")+QString(" v%1 (Profile: %2)").arg(version).arg(PREF[STR_GEN_Profile].toString())); this->setWindowTitle(tr("SleepyHead")+QString(" v%1 (Profile: %2)").arg(version).arg(PREF[STR_GEN_Profile].toString()));
//ui->tabWidget->setCurrentIndex(1); //ui->tabWidget->setCurrentIndex(1);
@ -1446,12 +1446,12 @@ void MainWindow::on_action_About_triggered()
QString gitrev=QString(GIT_REVISION); QString gitrev=QString(GIT_REVISION);
if (!gitrev.isEmpty()) gitrev="Revision: "+gitrev; if (!gitrev.isEmpty()) gitrev="Revision: "+gitrev;
QString msg=tr("<html><body><div align='center'><h2>SleepyHead v%1.%2.%3 (%7)</h2>Build Date: %4 %5<br/>%6<hr>" QString msg=tr("<html><body><div align='center'><h2>SleepyHead v%1.%2.%3-%4 (%8)</h2>Build Date: %5 %6<br/>%7<hr>"
"Copyright &copy;2011 Mark Watkins (jedimark) <br> \n" "Copyright &copy;2011 Mark Watkins (jedimark) <br> \n"
"<a href='http://sleepyhead.sourceforge.net'>http://sleepyhead.sourceforge.net</a> <hr>" "<a href='http://sleepyhead.sourceforge.net'>http://sleepyhead.sourceforge.net</a> <hr>"
"This software is released under the GNU Public License <br>" "This software is released under the GNU Public License <br>"
"<i>This software comes with absolutely no warranty, either express of implied. It comes with no guarantee of fitness for any particular purpose. No guarantees are made regarding the accuracy of any data this program displays." "<i>This software comes with absolutely no warranty, either express of implied. It comes with no guarantee of fitness for any particular purpose. No guarantees are made regarding the accuracy of any data this program displays."
"</div></body></html>").arg(major_version).arg(minor_version).arg(revision_number).arg(__DATE__).arg(__TIME__).arg(gitrev).arg(ReleaseStatus); "</div></body></html>").arg(major_version).arg(minor_version).arg(revision_number).arg(release_number).arg(__DATE__).arg(__TIME__).arg(gitrev).arg(ReleaseStatus);
QMessageBox msgbox(QMessageBox::Information,tr("About SleepyHead"),"",QMessageBox::Ok,this); QMessageBox msgbox(QMessageBox::Information,tr("About SleepyHead"),"",QMessageBox::Ok,this);
msgbox.setTextFormat(Qt::RichText); msgbox.setTextFormat(Qt::RichText);
msgbox.setText(msg); msgbox.setText(msg);

View File

@ -1559,7 +1559,6 @@
<string>&amp;File</string> <string>&amp;File</string>
</property> </property>
<addaction name="action_Import_Data"/> <addaction name="action_Import_Data"/>
<addaction name="actionImport_ZEO_Data"/>
<addaction name="action_Preferences"/> <addaction name="action_Preferences"/>
<addaction name="action_Edit_Profile"/> <addaction name="action_Edit_Profile"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -1617,10 +1616,12 @@
</widget> </widget>
<addaction name="menu_Purge_CPAP_Data"/> <addaction name="menu_Purge_CPAP_Data"/>
</widget> </widget>
<addaction name="actionImport_ZEO_Data"/>
<addaction name="separator"/>
<addaction name="action_Rebuild_Oximetry_Index"/> <addaction name="action_Rebuild_Oximetry_Index"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="separator"/>
<addaction name="menu_Advanced"/> <addaction name="menu_Advanced"/>
<addaction name="separator"/>
</widget> </widget>
<addaction name="menu_File"/> <addaction name="menu_File"/>
<addaction name="menu_View"/> <addaction name="menu_View"/>

View File

@ -158,7 +158,8 @@ PreferencesDialog::PreferencesDialog(QWidget *parent,Profile * _profile) :
ui->useAntiAliasing->setChecked(profile->appearance->antiAliasing()); ui->useAntiAliasing->setChecked(profile->appearance->antiAliasing());
ui->useSquareWavePlots->setChecked(profile->appearance->squareWavePlots()); ui->useSquareWavePlots->setChecked(profile->appearance->squareWavePlots());
ui->enableGraphSnapshots->setChecked(profile->appearance->graphSnapshots()); ui->enableGraphSnapshots->setChecked(profile->appearance->graphSnapshots());
ui->skipLoginScreen->setChecked(PREF["SkipLoginScreen"].toBool()); ui->skipLoginScreen->setChecked(PREF[STR_GEN_SkipLogin].toBool());
ui->allowEarlyUpdates->setChecked(PREF[STR_PREF_AllowEarlyUpdates].toBool());
ui->skipEmptyDays->setChecked(profile->general->skipEmptyDays()); ui->skipEmptyDays->setChecked(profile->general->skipEmptyDays());
ui->enableMultithreading->setChecked(profile->session->multithreading()); ui->enableMultithreading->setChecked(profile->session->multithreading());
@ -395,6 +396,7 @@ bool PreferencesDialog::Save()
PREF[STR_GEN_UpdatesAutoCheck]=ui->automaticallyCheckUpdates->isChecked(); PREF[STR_GEN_UpdatesAutoCheck]=ui->automaticallyCheckUpdates->isChecked();
PREF[STR_GEN_UpdateCheckFrequency]=ui->updateCheckEvery->value(); PREF[STR_GEN_UpdateCheckFrequency]=ui->updateCheckEvery->value();
PREF[STR_PREF_AllowEarlyUpdates]=ui->allowEarlyUpdates->isChecked();
PREF["Fonts_Application_Name"]=ui->applicationFont->currentText(); PREF["Fonts_Application_Name"]=ui->applicationFont->currentText();
PREF["Fonts_Application_Size"]=ui->applicationFontSize->value(); PREF["Fonts_Application_Size"]=ui->applicationFontSize->value();

View File

@ -1605,6 +1605,22 @@ Mainly affects the importer.</string>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QCheckBox" name="allowEarlyUpdates">
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;If your interested in helping test new features and bugfixes early, click here.&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;But please be warned this will sometimes mean breaky code..&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Allow experimental and test builds (Advanced users only please.)</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -1,12 +1,12 @@
<!DOCTYPE Upgrade> <!DOCTYPE Upgrade>
<SleepyHead> <SleepyHead>
<Release version="0.9.1" codename="Funky" status="beta"> <Release version="0.9.1" codename="Funky" status="beta">
<update type="qtlibs" version="4.8.0" platform="win32"> <update type="qtlibs" version="4.8.0" platform="win32" status="stable">
<file name="qtlibs-4.8.0-win32.zip" <file name="qtlibs-4.8.0-win32.zip"
url="http://sourceforge.net/projects/sleepyhead/files/AutoUpdate/Win32/qtlibs-4.8.0-win32.zip/download" url="http://sourceforge.net/projects/sleepyhead/files/AutoUpdate/Win32/qtlibs-4.8.0-win32.zip/download"
hash="ed0312c0f9a51e8774e6556f83b13df8d4195d2b"/> hash="ed0312c0f9a51e8774e6556f83b13df8d4195d2b"/>
</update> </update>
<update type="application" version="0.9.1" platform="win32" release_date="2012-01-10"> <update type="application" version="0.9.1" platform="win32" release_date="2012-01-10" status="testing">
<file name="SleepyHead-0.9.1-beta-win32-binary_only.zip" <file name="SleepyHead-0.9.1-beta-win32-binary_only.zip"
url="http://sourceforge.net/projects/sleepyhead/files/AutoUpdate/Win32/SleepyHead-0.9.1-beta-win32-binary_only.zip/download" url="http://sourceforge.net/projects/sleepyhead/files/AutoUpdate/Win32/SleepyHead-0.9.1-beta-win32-binary_only.zip/download"
hash="89cf16fbbc5dc5018946916dc8c95c01578635f8"/> hash="89cf16fbbc5dc5018946916dc8c95c01578635f8"/>
@ -14,7 +14,7 @@
Initial v0.9.1 release. Initial v0.9.1 release.
</notes> </notes>
</update> </update>
<update type="application" version="0.9.1" platform="macosx" release_date="2012-01-11"> <update type="application" version="0.9.1" platform="macosx" release_date="2012-01-11" status="stable">
<file name="SleepyHead-0.9.1-beta-macosx-binary_only.zip" <file name="SleepyHead-0.9.1-beta-macosx-binary_only.zip"
url="http://sourceforge.net/projects/sleepyhead/files/AutoUpdate/MacOSX/SleepyHead-0.9.1-beta-macosx-binary_only.zip/download" url="http://sourceforge.net/projects/sleepyhead/files/AutoUpdate/MacOSX/SleepyHead-0.9.1-beta-macosx-binary_only.zip/download"
hash="2f0983dfec2e9968b36ff8ccd7c24a1af5bb8818"/> hash="2f0983dfec2e9968b36ff8ccd7c24a1af5bb8818"/>

View File

@ -68,6 +68,17 @@ bool UpdateParser::characters(const QString &ch)
return true; return true;
} }
UpdateStatus lookupUpdateStatus(QString stat)
{
UpdateStatus status=UPDATE_TESTING;
if (stat=="testing") status=UPDATE_TESTING;
else if (stat=="beta") status=UPDATE_BETA;
else if (stat=="stable") status=UPDATE_STABLE;
else if (stat=="critical") status=UPDATE_CRITICAL;
return status;
}
bool UpdateParser::startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts) bool UpdateParser::startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
{ {
Q_UNUSED(namespaceURI) Q_UNUSED(namespaceURI)
@ -75,6 +86,7 @@ bool UpdateParser::startElement(const QString &namespaceURI, const QString &loca
QString name=qName.toLower(); QString name=qName.toLower();
if (inRelease && name=="update") { if (inRelease && name=="update") {
QString ver, type; QString ver, type;
UpdateStatus updatestatus=UPDATE_TESTING;
for (int i=0;i<atts.count();i++) { for (int i=0;i<atts.count();i++) {
if (atts.localName(i)=="type") if (atts.localName(i)=="type")
type=atts.value(i).toLower(); type=atts.value(i).toLower();
@ -84,12 +96,16 @@ bool UpdateParser::startElement(const QString &namespaceURI, const QString &loca
platform=atts.value(i).toLower(); platform=atts.value(i).toLower();
if (atts.localName(i)=="release_date") if (atts.localName(i)=="release_date")
release_date=atts.value(i); release_date=atts.value(i);
if (atts.localName(i)=="status") {
updatestatus=lookupUpdateStatus(atts.value(i).toLower());
}
} }
QDate date=QDate::fromString(release_date,"yyyy-MM-dd"); QDate date=QDate::fromString(release_date,"yyyy-MM-dd");
if (!date.isValid()) date=QDate::currentDate(); if (!date.isValid()) date=QDate::currentDate();
release->updates[platform].push_back(Update(type,ver,platform,date)); release->updates[platform].push_back(Update(type,ver,platform,date));
update=&release->updates[platform][release->updates[platform].size()-1]; update=&release->updates[platform][release->updates[platform].size()-1];
update->status=updatestatus;
inUpdate=true; inUpdate=true;
} else if (inRelease && name=="info") { } else if (inRelease && name=="info") {
QString tmp=atts.value("url"); QString tmp=atts.value("url");
@ -121,14 +137,16 @@ bool UpdateParser::startElement(const QString &namespaceURI, const QString &loca
inNotes=true; inNotes=true;
} else if (name=="release") { } else if (name=="release") {
inRelease=true; inRelease=true;
QString codename,status; QString codename;
UpdateStatus status=UPDATE_TESTING;
for (int i=0;i<atts.count();i++) { for (int i=0;i<atts.count();i++) {
if (atts.localName(i)=="version") if (atts.localName(i)=="version")
version=atts.value(i).toLower(); version=atts.value(i).toLower();
if (atts.localName(i)=="codename") if (atts.localName(i)=="codename")
codename=atts.value(i); codename=atts.value(i);
if (atts.localName(i)=="status") if (atts.localName(i)=="status") {
status=atts.value(i); status=lookupUpdateStatus(atts.value(i).toLower());
}
} }
releases[version]=Release(version,codename,status); releases[version]=Release(version,codename,status);
release=&releases[version]; release=&releases[version];

View File

@ -5,6 +5,8 @@
#include <QMetaType> #include <QMetaType>
#include <QDate> #include <QDate>
enum UpdateStatus { UPDATE_TESTING=0, UPDATE_BETA, UPDATE_STABLE, UPDATE_CRITICAL };
/*! \struct Update /*! \struct Update
\brief Holds platform specific information about an individual updates \brief Holds platform specific information about an individual updates
*/ */
@ -17,6 +19,7 @@ public:
QString type; QString type;
QString version; QString version;
QString platform; QString platform;
UpdateStatus status;
QDate date; QDate date;
QString filename; QString filename;
QString url; QString url;
@ -41,10 +44,10 @@ struct Release
updates=copy.updates; updates=copy.updates;
} }
Release(QString ver, QString code, QString stat) { version=ver; codename=code; status=stat; } Release(QString ver, QString code, UpdateStatus stat) { version=ver; codename=code; status=stat; }
QString version; QString version;
QString codename; QString codename;
QString status; UpdateStatus status;
QString info_url; QString info_url;
QHash<QString,QString> notes; // by platform QHash<QString,QString> notes; // by platform
QHash<QString,QList<Update> > updates; QHash<QString,QList<Update> > updates;

View File

@ -5,9 +5,12 @@
const int major_version=0; const int major_version=0;
const int minor_version=9; const int minor_version=9;
const int revision_number=1; const int revision_number=2;
const int release_number=1;
const QString VersionString=QString().sprintf("%i.%i.%i",major_version,minor_version,revision_number); const QString VersionString=QString().sprintf("%i.%i.%i",major_version,minor_version,revision_number);
const QString FullVersionString=QString().sprintf("%i.%i.%i-%i",major_version,minor_version,revision_number,release_number);
const QString ReleaseStatus="beta"; const QString ReleaseStatus="beta";
#ifdef Q_WS_MAC #ifdef Q_WS_MAC