mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-08 04:00:44 +00:00
Added Help->Check for Updates
This commit is contained in:
parent
dfdba127c9
commit
afbcee1a89
@ -1880,7 +1880,7 @@ void gGraphView::keyPressEvent(QKeyEvent * event)
|
|||||||
if (event->modifiers() & Qt::ControlModifier) zoom*=1.5;
|
if (event->modifiers() & Qt::ControlModifier) zoom*=1.5;
|
||||||
g->ZoomX(zoom,0); // Zoom out
|
g->ZoomX(zoom,0); // Zoom out
|
||||||
}
|
}
|
||||||
qDebug() << "Keypress??";
|
//qDebug() << "Keypress??";
|
||||||
}
|
}
|
||||||
void gGraphView::setDay(Day * day)
|
void gGraphView::setDay(Day * day)
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui webkit opengl xml
|
QT += core gui webkit opengl network xml
|
||||||
|
|
||||||
CONFIG += rtti
|
CONFIG += rtti
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include <QResource>
|
#include <QResource>
|
||||||
#include <QProgressBar>
|
#include <QProgressBar>
|
||||||
#include <QWebHistory>
|
#include <QWebHistory>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QNetworkReply>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
@ -137,6 +139,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
ui->tabWidget->setCurrentWidget(ui->welcome);
|
ui->tabWidget->setCurrentWidget(ui->welcome);
|
||||||
|
|
||||||
|
netmanager = new QNetworkAccessManager(this);
|
||||||
|
connect(netmanager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
|
||||||
}
|
}
|
||||||
extern MainWindow *mainwin;
|
extern MainWindow *mainwin;
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@ -397,3 +401,32 @@ void MainWindow::on_actionEnable_Multithreading_toggled(bool checked)
|
|||||||
{
|
{
|
||||||
pref["EnableMultithreading"]=checked;
|
pref["EnableMultithreading"]=checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionCheck_for_Updates_triggered()
|
||||||
|
{
|
||||||
|
netmanager->get(QNetworkRequest(QUrl("http://sleepyhead.sourceforge.net/current_version.txt")));
|
||||||
|
}
|
||||||
|
void MainWindow::replyFinished(QNetworkReply * reply)
|
||||||
|
{
|
||||||
|
if (reply->error()==QNetworkReply::NoError) {
|
||||||
|
// Wrap this crap in XML/JSON so can do other stuff.
|
||||||
|
if (reply->size()>20) {
|
||||||
|
qDebug() << "Doesn't look like a version file... :(";
|
||||||
|
} else {
|
||||||
|
// check in size
|
||||||
|
QByteArray data=reply->readAll();
|
||||||
|
QString a=data;
|
||||||
|
a=a.trimmed();
|
||||||
|
if (a>pref["VersionString"].toString()) {
|
||||||
|
if (QMessageBox::question(this,"New Version","A newer version of SleepyHead is available, v"+a+".\nWould you like to update?",QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) {
|
||||||
|
QMessageBox::information(this,"Laziness Warning","I'd love to do it for you automatically, but it's not implemented yet.. :)",QMessageBox::Ok);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
QMessageBox::information(this,"SleepyHead v"+a,"Your already up to date!",QMessageBox::Ok);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qDebug() << "Network Error:" << reply->errorString();
|
||||||
|
}
|
||||||
|
reply->deleteLater();
|
||||||
|
}
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QGLContext>
|
#include <QGLContext>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
#include "daily.h"
|
#include "daily.h"
|
||||||
#include "overview.h"
|
#include "overview.h"
|
||||||
#include "oximetry.h"
|
#include "oximetry.h"
|
||||||
@ -82,6 +83,9 @@ private slots:
|
|||||||
|
|
||||||
void on_actionEnable_Multithreading_toggled(bool arg1);
|
void on_actionEnable_Multithreading_toggled(bool arg1);
|
||||||
|
|
||||||
|
void on_actionCheck_for_Updates_triggered();
|
||||||
|
|
||||||
|
void replyFinished(QNetworkReply*);
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
Daily * daily;
|
Daily * daily;
|
||||||
@ -89,6 +93,7 @@ private:
|
|||||||
Oximetry * oximetry;
|
Oximetry * oximetry;
|
||||||
bool first_load;
|
bool first_load;
|
||||||
Profile *profile;
|
Profile *profile;
|
||||||
|
QNetworkAccessManager *netmanager;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
@ -605,6 +605,7 @@
|
|||||||
<string>&Help</string>
|
<string>&Help</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionDebug"/>
|
<addaction name="actionDebug"/>
|
||||||
|
<addaction name="actionCheck_for_Updates"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="action_About"/>
|
<addaction name="action_About"/>
|
||||||
</widget>
|
</widget>
|
||||||
@ -746,6 +747,11 @@
|
|||||||
</string>
|
</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionCheck_for_Updates">
|
||||||
|
<property name="text">
|
||||||
|
<string>Check for &Updates</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
Loading…
Reference in New Issue
Block a user