HelpDialog.cpp   HelpDialog.cpp 
skipping to change at line 41 skipping to change at line 41
#include <QPair> #include <QPair>
#include <QtAlgorithms> #include <QtAlgorithms>
#include <QDebug> #include <QDebug>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QNetworkReply> #include <QNetworkReply>
#include <QFileInfo> #include <QFileInfo>
#include <QFile> #include <QFile>
#include <QDir> #include <QDir>
#include <QProcess> #include <QProcess>
#include <QSysInfo> #include <QSysInfo>
#include <QGLFormat>
#include "ui_helpDialogGui.h" #include "ui_helpDialogGui.h"
#include "HelpDialog.hpp" #include "HelpDialog.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelGui.hpp" #include "StelGui.hpp"
#include "StelGuiItems.hpp" #include "StelGuiItems.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
skipping to change at line 127 skipping to change at line 128
//qDebug() << "HelpDialog::createDialogContent() using file: " << QDir::toNativeSeparators(jsonDataPath); //qDebug() << "HelpDialog::createDialogContent() using file: " << QDir::toNativeSeparators(jsonDataPath);
// Set up download manager and the update schedule // Set up download manager and the update schedule
downloadMgr = new QNetworkAccessManager(this); downloadMgr = new QNetworkAccessManager(this);
connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateDownloadComplete(QNetworkReply*))); connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateDownloadComplete(QNetworkReply*)));
updateState = CompleteNoUpdates; updateState = CompleteNoUpdates;
updateJSON(); updateJSON();
} }
//Kinetic scrolling for tablet pc and pc
QList<QWidget *> addscroll;
addscroll << ui->helpBrowser << ui->aboutBrowser << ui->logBrowser;
installKineticScrolling(addscroll);
// Help page // Help page
updateText(); updateText();
connect(ui->editShortcutsButton, SIGNAL(clicked()), connect(ui->editShortcutsButton, SIGNAL(clicked()), this, SLOT(showS
this, SLOT(showShortcutsWindow())); hortcutsWindow()));
// Log page // Log page
ui->logPathLabel->setText(QString("%1/log.txt:").arg(StelFileMgr::ge tUserDir())); ui->logPathLabel->setText(QString("%1/log.txt:").arg(StelFileMgr::ge tUserDir()));
connect(ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(u pdateLog(int))); connect(ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(u pdateLog(int)));
connect(ui->refreshButton, SIGNAL(clicked()), this, SLOT(refreshLog( ))); connect(ui->refreshButton, SIGNAL(clicked()), this, SLOT(refreshLog( )));
connect(ui->stackListWidget, SIGNAL(currentItemChanged(QListWidgetIt em *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWi dgetItem*))); connect(ui->stackListWidget, SIGNAL(currentItemChanged(QListWidgetIt em *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWi dgetItem*)));
} }
skipping to change at line 225 skipping to change at line 230
} }
catch(std::runtime_error& e) catch(std::runtime_error& e)
{ {
qDebug() << "HelpDialog::getLatestVersionFromJson() error:" << e.what(); qDebug() << "HelpDialog::getLatestVersionFromJson() error:" << e.what();
} }
//qDebug() << "HelpDialog::getLatestVersionFromJson() latest version from file:" << jsonVersion; //qDebug() << "HelpDialog::getLatestVersionFromJson() latest version from file:" << jsonVersion;
return jsonVersion; return jsonVersion;
} }
int HelpDialog::getRequiredOpenGLVersionFromJson()
{
int jsonVersion = 0;
QFile jsonDataFile(jsonDataPath);
if (!jsonDataFile.open(QIODevice::ReadOnly))
{
qWarning() << "HelpDialog::getRequiredOpenGLVersionFromJson(
) cannot open " << QDir::toNativeSeparators(jsonDataPath);
return jsonVersion;
}
QVariantMap map;
try
{
map = StelJsonParser::parse(&jsonDataFile).toMap();
if (map.contains("requiredOpenGLVersion"))
{
jsonVersion = map.value("requiredOpenGLVersion").toI
nt();
}
jsonDataFile.close();
}
catch(std::runtime_error& e)
{
qDebug() << "HelpDialog::getRequiredOpenGLVersionFromJson()
error:" << e.what();
}
//qDebug() << "HelpDialog::getRequiredOpenGLVersionFromJson() requir
ed OpenGL version from file:" << jsonVersion;
return jsonVersion;
}
/* /*
Replace the JSON file with the default from the compiled-in resource Replace the JSON file with the default from the compiled-in resource
*/ */
void HelpDialog::restoreDefaultJsonFile(void) void HelpDialog::restoreDefaultJsonFile(void)
{ {
QFile src(StelFileMgr::findFile("data/updates.json")); QFile src(StelFileMgr::findFile("data/updates.json"));
if (!src.copy(jsonDataPath)) if (!src.copy(jsonDataPath))
{ {
qWarning() << "HelpDialog::restoreDefaultJsonFile() cannot c opy json resource to " + QDir::toNativeSeparators(jsonDataPath); qWarning() << "HelpDialog::restoreDefaultJsonFile() cannot c opy json resource to " + QDir::toNativeSeparators(jsonDataPath);
} }
skipping to change at line 248 skipping to change at line 282
// The resource is read only, and the new file inherits this ... make sure the new file // The resource is read only, and the new file inherits this ... make sure the new file
// is writable by the Stellarium process so that updates can be done. // is writable by the Stellarium process so that updates can be done.
QFile dest(jsonDataPath); QFile dest(jsonDataPath);
dest.setPermissions(dest.permissions() | QFile::WriteOwner); dest.setPermissions(dest.permissions() | QFile::WriteOwner);
} }
} }
void HelpDialog::readJsonFile() void HelpDialog::readJsonFile()
{ {
QString version = getLatestVersionFromJson(); QString version = getLatestVersionFromJson();
unsigned int OpenGLversion = getRequiredOpenGLVersionFromJson();
if (version!=currentVersion) if (version!=currentVersion)
{ {
setUpdatesMessage(true, version); setUpdatesMessage(true, version, OpenGLversion);
} }
} }
void HelpDialog::setUpdatesMessage(bool hasUpdates, QString version) void HelpDialog::setUpdatesMessage(bool hasUpdates, QString version, int Op enGL)
{ {
if (version.contains("unknown")) if (version.contains("unknown"))
{ {
// TRANSLATORS: This message will be displayed for users if Stellarium can't get info about version from stellarium.org // TRANSLATORS: This message will be displayed for users if Stellarium can't get info about version from stellarium.org
updatesMessage = q_("Oops... Stellarium can't check latest v ersion."); updatesMessage = q_("Oops... Stellarium can't check latest v ersion.");
return; return;
} }
int cVMajor = 0, cVMinor = 0, cVPatch = 0, rVMajor = 0, rVMinor = 0, rVPatch = 0; int cVMajor = 0, cVMinor = 0, cVPatch = 0, rVMajor = 0, rVMinor = 0, rVPatch = 0;
QRegExp vRx("(\\d+)\\.(\\d+)\\.(\\d+)"); QRegExp vRx("(\\d+)\\.(\\d+)\\.(\\d+)");
if (vRx.exactMatch(currentVersion)) if (vRx.exactMatch(currentVersion))
skipping to change at line 287 skipping to change at line 322
{ {
if ((cVMajor>rVMajor) || (cVMinor>rVMinor) || (cVPatch>rVPat ch)) if ((cVMajor>rVMajor) || (cVMinor>rVMinor) || (cVPatch>rVPat ch))
{ {
// TRANSLATORS: This message will be displayed for u sers if current version of Stellarium is bigger than version from stellariu m.org // TRANSLATORS: This message will be displayed for u sers if current version of Stellarium is bigger than version from stellariu m.org
updatesMessage = q_("Looks like you are using the de velopment version of Stellarium."); updatesMessage = q_("Looks like you are using the de velopment version of Stellarium.");
} }
else else
{ {
// TRANSLATORS: This message will be displayed for u sers if current version of Stellarium is smaller than version from stellari um.org // TRANSLATORS: This message will be displayed for u sers if current version of Stellarium is smaller than version from stellari um.org
updatesMessage = q_("This version of Stellarium is o utdated! Latest version is %1.").arg(version); updatesMessage = q_("This version of Stellarium is o utdated! Latest version is %1.").arg(version);
if (!(QGLFormat::openGLVersionFlags() & OpenGL))
{
updatesMessage.append(q_(" Sorry, your hardw
are is not compatible with newest version of Stellarium!"));
}
} }
} }
else else
{ {
// TRANSLATORS: This message will be displayed for users if current version of Stellarium is equals with version from stellarium.org // TRANSLATORS: This message will be displayed for users if current version of Stellarium is equals with version from stellarium.org
updatesMessage = q_("This is latest stable version of Stella rium."); updatesMessage = q_("This is latest stable version of Stella rium.");
} }
} }
QString HelpDialog::getUpdatesMessage() QString HelpDialog::getUpdatesMessage()
 End of changes. 8 change blocks. 
4 lines changed or deleted 49 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/