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

View file

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

View file

@ -23,7 +23,7 @@ UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QString latest
QFile updateDialogUi("resources/ui/updateDialog.ui");
updateDialogUi.open(QFile::ReadOnly);
dialogWidget = updateDialogLoader.load(&updateDialogUi, parent);
_dialogWidget = updateDialogLoader.load(&updateDialogUi, parent);
updateDialogUi.close();
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);
QPushButton *downloadButton = dialogWidget->findChild<QPushButton *>("downloadButton");
QPushButton *skipButton = dialogWidget->findChild<QPushButton *>("skipButton");
QPushButton *closeButton = dialogWidget->findChild<QPushButton *>("closeButton");
QLabel *updateContent = dialogWidget->findChild<QLabel *>("updateContent");
QPushButton* downloadButton = _dialogWidget->findChild<QPushButton*>("downloadButton");
QPushButton* skipButton = _dialogWidget->findChild<QPushButton*>("skipButton");
QPushButton* closeButton = _dialogWidget->findChild<QPushButton*>("closeButton");
QLabel* updateContent = _dialogWidget->findChild<QLabel*>("updateContent");
updateContent->setText(updateRequired);
connect(downloadButton, SIGNAL(released()), this, SLOT(handleDownload(QUrl downloadURL)));
connect(skipButton, SIGNAL(released()), this, SLOT(handleSkip()));
connect(closeButton, SIGNAL(released()), this, SLOT(handleClose()));
dialogWidget->show();
_dialogWidget->show();
}
void UpdateDialog::handleDownload(QUrl downloadURL) {
@ -53,6 +53,7 @@ void UpdateDialog::handleDownload(QUrl downloadURL) {
}
void UpdateDialog::handleSkip() {
this->close();
}

View file

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