Work on updating...

This commit is contained in:
Martin Rotter 2014-02-20 14:39:48 +01:00
parent f04e3617fc
commit edc2bfaad9
3 changed files with 42 additions and 3 deletions

View File

@ -129,6 +129,18 @@
#define FDS_MODEL_TITLE_INDEX 0
#define FDS_MODEL_COUNTS_INDEX 1
#if defined(Q_OS_LINUX)
#define OS_ID "Linux"
#elif defined(Q_OS_OSX)
#define OS_ID "Mac OS X"
#elif defined(Q_OS_WIN)
#define OS_ID "Windows"
#elif defined(Q_OS_OS2)
#define OS_ID "OS2"
#else
#define OS_ID ""
#endif
#if defined(Q_OS_LINUX) || defined(Q_OS_OSX)
#define APP_DESKTOP_ENTRY_PATH "@DESKTOP_ENTRY_PATH@"
#define APP_DESKTOP_ENTRY_FILE "@APP_LOW_NAME@.desktop"

29
src/gui/formupdate.cpp Normal file → Executable file
View File

@ -48,6 +48,23 @@ void FormUpdate::updateChanges(int new_release_index) {
UpdateInfo info = m_ui->m_cmbAvailableRelease->comboBox()->itemData(new_release_index).value<UpdateInfo>();
m_ui->m_txtChanges->setText(info.m_changes);
if (info.m_availableVersion > APP_VERSION) {
m_ui->m_cmbAvailableRelease->setStatus(WidgetWithStatus::Ok,
tr("This is new version which can be\ndownloaded and installed."));
}
else {
m_ui->m_cmbAvailableRelease->setStatus(WidgetWithStatus::Warning,
tr("This release is not newer than\ncurrently installed one.."));
}
m_ui->m_lblPlatforms->setText(QStringList(info.m_urls.keys()).join(", "));
// TODO: PODLE definice OS_ID (defs.h) se zjisti esli info.m_urls.keys()
// obsahuje instalacni soubor pro danou platformu
// a pokud ano tak se umoznuje update (jen windows a os2)
// budou zahrnuty i "prazdne" soubory pro ostatni platformy
// ale na tech nebude mozno updatovat.
}
}
@ -57,11 +74,21 @@ void FormUpdate::checkForUpdates() {
5000,
releases_xml);
m_ui->m_cmbAvailableRelease->comboBox()->clear();
if (download_result != QNetworkReply::NoError) {
m_ui->m_lblPlatforms->setText("-");
m_ui->m_cmbAvailableRelease->setEnabled(false);
m_ui->m_cmbAvailableRelease->setStatus(WidgetWithStatus::Error,
tr("List with updates was not\ndownloaded successfully."));
return;
}
QList<UpdateInfo> releases_list = SystemFactory::instance()->parseUpdatesFile(releases_xml);
foreach (const UpdateInfo &release, releases_list) {
m_ui->m_cmbAvailableRelease->comboBox()->addItem(release.m_availableVersion,
QVariant::fromValue(release));
}
}

4
src/gui/formupdate.ui Normal file → Executable file
View File

@ -36,7 +36,7 @@
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Available releases</string>
<string>Available releaseS</string>
</property>
</widget>
</item>
@ -75,7 +75,7 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="m_lblSupportedPlatforms">
<widget class="QLabel" name="m_lblPlatforms">
<property name="text">
<string/>
</property>