PR Changes

This commit is contained in:
Leonardo Murillo 2014-01-17 13:35:49 -06:00
parent e0761db6d1
commit 93e4dc7d5a
4 changed files with 14 additions and 13 deletions

View file

@ -4418,13 +4418,14 @@ void Application::parseVersionXml(QNetworkReply *reply) {
} }
if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) { if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
updateDialog = new UpdateDialog(_glWidget, releaseNotes); updateDialog = new UpdateDialog(_glWidget, releaseNotes, latestVersion, downloadURL);
} }
} }
QFile *Application::loadSkipFile() { QFile *Application::loadSkipFile() {
QString fileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation); QString fileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
fileName.append(QString("/hifi.skipversion")); fileName.append(QString("/hifi.skipversion"));
qDebug("###### FILENAME %s \n", fileName.toStdString().c_str());
QFile *file = new QFile(fileName); QFile *file = new QFile(fileName);
file->open(QIODevice::ReadWrite); file->open(QIODevice::ReadWrite);
return file; return file;
@ -4435,7 +4436,7 @@ bool Application::shouldSkipVersion(QString latestVersion) {
QByteArray skipFileContents = skipFile->readAll(); QByteArray skipFileContents = skipFile->readAll();
QString *skipVersion = new QString(skipFileContents); QString *skipVersion = new QString(skipFileContents);
skipFile->close(); skipFile->close();
if (*skipVersion == latestVersion || applicationVersion() == "0.1") { if (*skipVersion == latestVersion /*|| applicationVersion() == "0.1"*/) {
return true; return true;
} }
return false; return false;

View file

@ -250,6 +250,8 @@ private slots:
void restoreMirrorView(); void restoreMirrorView();
void shrinkMirrorView(); void shrinkMirrorView();
void resetSensors(); void resetSensors();
void parseVersionXml(QNetworkReply *reply);
private: private:
void resetCamerasOnResizeGL(Camera& camera, int width, int height); void resetCamerasOnResizeGL(Camera& camera, int width, int height);
@ -497,13 +499,11 @@ private:
QString getLocalVoxelCacheFileName(); QString getLocalVoxelCacheFileName();
void updateLocalOctreeCache(bool firstTime = false); void updateLocalOctreeCache(bool firstTime = false);
QFile *loadSkipFile(); QFile* loadSkipFile();
void checkVersion(); void checkVersion();
void displayUpdateDialog(); void displayUpdateDialog();
bool shouldSkipVersion(QString latestVersion); bool shouldSkipVersion(QString latestVersion);
void skipVersion(QString latestVersion); void skipVersion(QString latestVersion);
void parseVersionXml(QNetworkReply *reply);
}; };
#endif /* defined(__interface__Application__) */ #endif /* defined(__interface__Application__) */

View file

@ -23,7 +23,7 @@ UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QString latest
QFile updateDialogUi("resources/ui/updateDialog.ui"); QFile updateDialogUi("resources/ui/updateDialog.ui");
updateDialogUi.open(QFile::ReadOnly); updateDialogUi.open(QFile::ReadOnly);
dialogWidget = updateDialogLoader.load(&updateDialogUi, parent); _dialogWidget = updateDialogLoader.load(&updateDialogUi, parent);
updateDialogUi.close(); updateDialogUi.close();
const QString updateRequired = QString("You are currently running build %1, the latest build released is %2. \ const QString updateRequired = QString("You are currently running build %1, the latest build released is %2. \
@ -33,17 +33,17 @@ UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QString latest
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
QPushButton *downloadButton = dialogWidget->findChild<QPushButton *>("downloadButton"); QPushButton* downloadButton = _dialogWidget->findChild<QPushButton*>("downloadButton");
QPushButton *skipButton = dialogWidget->findChild<QPushButton *>("skipButton"); QPushButton* skipButton = _dialogWidget->findChild<QPushButton*>("skipButton");
QPushButton *closeButton = dialogWidget->findChild<QPushButton *>("closeButton"); QPushButton* closeButton = _dialogWidget->findChild<QPushButton*>("closeButton");
QLabel *updateContent = dialogWidget->findChild<QLabel *>("updateContent"); QLabel* updateContent = _dialogWidget->findChild<QLabel*>("updateContent");
updateContent->setText(updateRequired); updateContent->setText(updateRequired);
connect(downloadButton, SIGNAL(released()), this, SLOT(handleDownload(QUrl downloadURL))); connect(downloadButton, SIGNAL(released()), this, SLOT(handleDownload(QUrl downloadURL)));
connect(skipButton, SIGNAL(released()), this, SLOT(handleSkip())); connect(skipButton, SIGNAL(released()), this, SLOT(handleSkip()));
connect(closeButton, SIGNAL(released()), this, SLOT(handleClose())); connect(closeButton, SIGNAL(released()), this, SLOT(handleClose()));
dialogWidget->show(); _dialogWidget->show();
} }
void UpdateDialog::handleDownload(QUrl downloadURL) { void UpdateDialog::handleDownload(QUrl downloadURL) {
@ -53,6 +53,7 @@ void UpdateDialog::handleDownload(QUrl downloadURL) {
} }
void UpdateDialog::handleSkip() { void UpdateDialog::handleSkip() {
this->close(); this->close();
} }

View file

@ -22,10 +22,9 @@ class UpdateDialog : public QDialog {
public: public:
UpdateDialog(QWidget*, QString releaseNotes, QString latestVersion, QUrl downloadURL); UpdateDialog(QWidget*, QString releaseNotes, QString latestVersion, QUrl downloadURL);
~UpdateDialog();
private: private:
QWidget *dialogWidget; QWidget* _dialogWidget;
private slots: private slots:
void handleDownload(QUrl downloadURL); void handleDownload(QUrl downloadURL);