mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 03:30:44 +00:00
Fix ResMed importer backup & gz glitch, remove quazip dependency
This commit is contained in:
parent
0b8ada6d64
commit
a369e2dac4
@ -239,9 +239,11 @@ bool EDFParser::Open(const QString & name)
|
|||||||
goto badfile;
|
goto badfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EDFMutex.lock();
|
||||||
// Open gzip file for reading
|
// Open gzip file for reading
|
||||||
gzFile f = gzopen(name.toLatin1(), "rb");
|
gzFile f = gzopen(name.toLatin1(), "rb");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
EDFMutex.unlock();
|
||||||
goto badfile;
|
goto badfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,6 +252,7 @@ bool EDFParser::Open(const QString & name)
|
|||||||
buffer = new char [datasize];
|
buffer = new char [datasize];
|
||||||
gzread(f, buffer, datasize);
|
gzread(f, buffer, datasize);
|
||||||
gzclose(f);
|
gzclose(f);
|
||||||
|
EDFMutex.unlock();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Open and read uncompressed file
|
// Open and read uncompressed file
|
||||||
@ -292,3 +295,5 @@ EDFSignal *EDFParser::lookupLabel(const QString & name, int index)
|
|||||||
|
|
||||||
return it.value()[index];
|
return it.value()[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMutex EDFParser::EDFMutex;
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QMutex>
|
||||||
|
|
||||||
#include "SleepLib/common.h"
|
#include "SleepLib/common.h"
|
||||||
|
|
||||||
@ -163,6 +164,7 @@ class EDFParser
|
|||||||
qint64 startdate;
|
qint64 startdate;
|
||||||
qint64 enddate;
|
qint64 enddate;
|
||||||
QString reserved44;
|
QString reserved44;
|
||||||
|
static QMutex EDFMutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1467,8 +1467,9 @@ int ResmedLoader::scanFiles(Machine * mach, const QString & datalog_path)
|
|||||||
if (filename.endsWith(STR_ext_gz)) {
|
if (filename.endsWith(STR_ext_gz)) {
|
||||||
filename.chop(3);
|
filename.chop(3);
|
||||||
}
|
}
|
||||||
|
QString fullpath = fi.filePath();
|
||||||
|
|
||||||
QString newpath = create_backups ? backup(fi.canonicalFilePath(), backup_path) : fi.canonicalFilePath();
|
QString newpath = create_backups ? backup(fullpath, backup_path) : fullpath;
|
||||||
|
|
||||||
|
|
||||||
// Accept only .edf and .edf.gz files
|
// Accept only .edf and .edf.gz files
|
||||||
@ -1495,6 +1496,10 @@ int ResmedLoader::scanFiles(Machine * mach, const QString & datalog_path)
|
|||||||
resday.files[filename] = newpath;
|
resday.files[filename] = newpath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG_EFFICIENCY
|
||||||
|
qDebug() << "Scanning EDF files took" << time.elapsed() << "ms";
|
||||||
|
#endif
|
||||||
|
|
||||||
return resdayList.size();
|
return resdayList.size();
|
||||||
}
|
}
|
||||||
/*// Check for duplicates
|
/*// Check for duplicates
|
||||||
@ -2114,7 +2119,7 @@ void ResDayTask::run()
|
|||||||
OverlappingEDF & B = next_oit.value();
|
OverlappingEDF & B = next_oit.value();
|
||||||
int gap = B.start - A.end;
|
int gap = B.start - A.end;
|
||||||
if (gap < 60) {
|
if (gap < 60) {
|
||||||
qDebug() << "Only a" << gap << "s sgap between ResMed sessions on" << resday->date.toString();
|
// qDebug() << "Only a" << gap << "s sgap between ResMed sessions on" << resday->date.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2452,7 +2457,10 @@ int ResmedLoader::Open(const QString & dirpath)
|
|||||||
|
|
||||||
QString backupfile = strBackupPath+"/"+newname;
|
QString backupfile = strBackupPath+"/"+newname;
|
||||||
|
|
||||||
if (compress_backups) backupfile += STR_ext_gz;
|
QString gzfile = backupfile + STR_ext_gz;
|
||||||
|
QString nongzfile = backupfile;
|
||||||
|
|
||||||
|
backupfile = compress_backups ? gzfile : nongzfile;
|
||||||
|
|
||||||
if (!QFile::exists(backupfile)) {
|
if (!QFile::exists(backupfile)) {
|
||||||
if (filename.endsWith(STR_ext_gz,Qt::CaseInsensitive)) {
|
if (filename.endsWith(STR_ext_gz,Qt::CaseInsensitive)) {
|
||||||
@ -2470,6 +2478,12 @@ int ResmedLoader::Open(const QString & dirpath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Remove any duplicate compressed/uncompressed
|
||||||
|
if (compress_backups) {
|
||||||
|
QFile::exists(nongzfile) && QFile::remove(nongzfile);
|
||||||
|
} else {
|
||||||
|
QFile::exists(gzfile) && QFile::remove(gzfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
STRmap[date] = STRFile(backupfile, stredf);
|
STRmap[date] = STRFile(backupfile, stredf);
|
||||||
@ -2543,6 +2557,8 @@ int ResmedLoader::Open(const QString & dirpath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compress_backups ? compressFile(path + "STR.edf", backup_path + "STR.edf.gz") : QFile::copy(path + "STR.edf", backup_path + "STR.edf");
|
||||||
|
|
||||||
// Copy Identification files to backup folder
|
// Copy Identification files to backup folder
|
||||||
QFile::copy(path + RMS9_STR_idfile + STR_ext_TGT, backup_path + RMS9_STR_idfile + STR_ext_TGT);
|
QFile::copy(path + RMS9_STR_idfile + STR_ext_TGT, backup_path + RMS9_STR_idfile + STR_ext_TGT);
|
||||||
QFile::copy(path + RMS9_STR_idfile + STR_ext_CRC, backup_path + RMS9_STR_idfile + STR_ext_CRC);
|
QFile::copy(path + RMS9_STR_idfile + STR_ext_CRC, backup_path + RMS9_STR_idfile + STR_ext_CRC);
|
||||||
@ -2758,13 +2774,16 @@ int ResmedLoader::Open(const QString & dirpath)
|
|||||||
|
|
||||||
QString ResmedLoader::backup(const QString & fullname, const QString & backup_path)
|
QString ResmedLoader::backup(const QString & fullname, const QString & backup_path)
|
||||||
{
|
{
|
||||||
|
QDir dir;
|
||||||
|
QString filename, yearstr, newname, oldname;
|
||||||
|
|
||||||
bool compress = p_profile->session->compressBackupData();
|
bool compress = p_profile->session->compressBackupData();
|
||||||
|
|
||||||
QString filename, yearstr, newname, oldname;
|
bool ok;
|
||||||
bool ok, gz = (fullname.right(3).toLower() == STR_ext_gz);
|
bool gz = (fullname.right(3).toLower() == STR_ext_gz); // Input file is a .gz?
|
||||||
|
|
||||||
|
|
||||||
filename = fullname.section("/", -1);
|
filename = fullname.section("/", -1);
|
||||||
|
|
||||||
if (gz) {
|
if (gz) {
|
||||||
filename.chop(3);
|
filename.chop(3);
|
||||||
}
|
}
|
||||||
@ -2772,61 +2791,48 @@ QString ResmedLoader::backup(const QString & fullname, const QString & backup_pa
|
|||||||
yearstr = filename.left(4);
|
yearstr = filename.left(4);
|
||||||
yearstr.toInt(&ok, 10);
|
yearstr.toInt(&ok, 10);
|
||||||
|
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
qDebug() << "Invalid EDF filename given to ResMedLoader::backup()";
|
qDebug() << "Invalid EDF filename given to ResMedLoader::backup()" << fullname;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
newname = backup_path + RMS9_STR_datalog + "/" + yearstr;
|
QString newpath = backup_path + RMS9_STR_datalog + "/" + yearstr;
|
||||||
QDir dir;
|
!dir.exists(newpath) && dir.mkpath(newpath);
|
||||||
dir.mkpath(newname);
|
|
||||||
newname += "/" + filename;
|
newname = newpath+"/"+filename;
|
||||||
|
|
||||||
QString tmpname = newname;
|
QString tmpname = newname;
|
||||||
|
|
||||||
if (compress) {
|
QString newnamegz = newname + STR_ext_gz;
|
||||||
newname += STR_ext_gz;
|
QString newnamenogz = newname;
|
||||||
}
|
|
||||||
|
|
||||||
// First make sure the correct backup exists.
|
newname = compress ? newnamegz : newnamenogz;
|
||||||
|
|
||||||
|
// First make sure the correct backup exists in the right place
|
||||||
if (!QFile::exists(newname)) {
|
if (!QFile::exists(newname)) {
|
||||||
if (compress) {
|
if (compress) {
|
||||||
gz ?
|
// If input file is already compressed.. copy it to the right location, otherwise compress it
|
||||||
QFile::copy(fullname, newname) // Already compressed.. copy it to the right location
|
gz ? QFile::copy(fullname, newname) : compressFile(fullname, newname);
|
||||||
:
|
|
||||||
compressFile(fullname, newname);
|
|
||||||
} else {
|
} else {
|
||||||
// dont really care if it's compressed and not meant to be, leave it that way
|
// If inputs a gz, uncompress it, otherwise copy is raw
|
||||||
QFile::copy(fullname, newname);
|
gz ? uncompressFile(fullname, newname) : QFile::copy(fullname, newname);
|
||||||
}
|
}
|
||||||
} // else backup already exists...
|
} // else backup already exists... good.
|
||||||
|
|
||||||
// Now the correct backup is in place, we can trash any
|
// Now the correct backup is in place, we can trash any
|
||||||
if (compress) {
|
if (compress) {
|
||||||
// Remove any uncompressed duplicate
|
// Remove any uncompressed duplicate
|
||||||
if (QFile::exists(tmpname)) {
|
QFile::exists(newnamenogz) && QFile::remove(newnamenogz);
|
||||||
QFile::remove(tmpname);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Delete the non compressed copy and choose it instead.
|
// Delete the non compressed copy and choose it instead.
|
||||||
if (QFile::exists(tmpname + STR_ext_gz)) {
|
QFile::exists(newnamegz) && QFile::remove(newnamegz);
|
||||||
QFile::remove(tmpname);
|
|
||||||
newname = tmpname + STR_ext_gz;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used to store it under Backup\Datalog
|
||||||
// Remove any traces from old backup directory structure
|
// Remove any traces from old backup directory structure
|
||||||
oldname = backup_path + RMS9_STR_datalog + "/" + filename;
|
oldname = backup_path + RMS9_STR_datalog + "/" + filename;
|
||||||
|
QFile::exists(oldname) && QFile::remove(oldname);
|
||||||
if (QFile::exists(oldname)) {
|
QFile::exists(oldname + STR_ext_gz) && QFile::remove(oldname + STR_ext_gz);
|
||||||
QFile::remove(oldname);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (QFile::exists(oldname + STR_ext_gz)) {
|
|
||||||
QFile::remove(oldname + STR_ext_gz);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newname;
|
return newname;
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,7 @@ bool compressFile(QString infile, QString outfile)
|
|||||||
}
|
}
|
||||||
if (QFile::exists(outfile)) {
|
if (QFile::exists(outfile)) {
|
||||||
qDebug() << "compressFile()" << outfile << "already exists";
|
qDebug() << "compressFile()" << outfile << "already exists";
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFile f(infile);
|
QFile f(infile);
|
||||||
@ -198,6 +199,7 @@ bool compressFile(QString infile, QString outfile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
f.close();
|
f.close();
|
||||||
|
|
||||||
gzFile gz = gzopen(outfile.toLatin1(), "wb");
|
gzFile gz = gzopen(outfile.toLatin1(), "wb");
|
||||||
|
|
||||||
//gzbuffer(gz,65536*2);
|
//gzbuffer(gz,65536*2);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* UpdaterWindow
|
/* UpdaterWindow
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
||||||
*
|
*
|
||||||
@ -23,8 +23,8 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
#include "SleepLib/profiles.h"
|
#include "SleepLib/profiles.h"
|
||||||
#include <quazip/quazip.h>
|
//#include <quazip/quazip.h>
|
||||||
#include <quazip/quazipfile.h>
|
//#include <quazip/quazipfile.h>
|
||||||
#include "UpdaterWindow.h"
|
#include "UpdaterWindow.h"
|
||||||
#include "ui_UpdaterWindow.h"
|
#include "ui_UpdaterWindow.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
@ -67,8 +67,7 @@ UpdaterWindow::UpdaterWindow(QWidget *parent) :
|
|||||||
|
|
||||||
UpdaterWindow::~UpdaterWindow()
|
UpdaterWindow::~UpdaterWindow()
|
||||||
{
|
{
|
||||||
disconnect(netmanager, SIGNAL(finished(QNetworkReply *)), this,
|
disconnect(netmanager, SIGNAL(finished(QNetworkReply *)), this, SLOT(replyFinished(QNetworkReply *)));
|
||||||
SLOT(replyFinished(QNetworkReply *)));
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +92,7 @@ void UpdaterWindow::checkForUpdates()
|
|||||||
{
|
{
|
||||||
QString platform=platformStr();
|
QString platform=platformStr();
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WIN32
|
||||||
QString filename = QApplication::applicationDirPath() + "/Updates.xml";
|
QString filename = QApplication::applicationDirPath() + "/Updates.xml";
|
||||||
#else
|
#else
|
||||||
QString filename = QApplication::applicationDirPath() + QString("/LatestVersion-%1").arg(platform);
|
QString filename = QApplication::applicationDirPath() + QString("/LatestVersion-%1").arg(platform);
|
||||||
@ -107,7 +106,7 @@ void UpdaterWindow::checkForUpdates()
|
|||||||
if (age < 900) {
|
if (age < 900) {
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
file.open(QFile::ReadOnly);
|
file.open(QFile::ReadOnly);
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WIN32
|
||||||
ParseUpdatesXML(&file);
|
ParseUpdatesXML(&file);
|
||||||
#else
|
#else
|
||||||
ParseLatestVersion(&file);
|
ParseLatestVersion(&file);
|
||||||
@ -119,7 +118,7 @@ void UpdaterWindow::checkForUpdates()
|
|||||||
|
|
||||||
mainwin->Notify(tr("Checking for SleepyHead Updates"));
|
mainwin->Notify(tr("Checking for SleepyHead Updates"));
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WIN32
|
||||||
update_url = QUrl(QString("http://sleepyhead.jedimark.net/packages/%1/Updates.xml").arg(platform));
|
update_url = QUrl(QString("http://sleepyhead.jedimark.net/packages/%1/Updates.xml").arg(platform));
|
||||||
#else
|
#else
|
||||||
update_url = QUrl(QString("http://sleepyhead.jedimark.net/releases/LatestVersion-%1").arg(platform));
|
update_url = QUrl(QString("http://sleepyhead.jedimark.net/releases/LatestVersion-%1").arg(platform));
|
||||||
@ -135,7 +134,6 @@ void UpdaterWindow::downloadUpdateXML()
|
|||||||
req.setRawHeader("User-Agent", "Wget/1.12 (linux-gnu)");
|
req.setRawHeader("User-Agent", "Wget/1.12 (linux-gnu)");
|
||||||
reply = netmanager->get(req);
|
reply = netmanager->get(req);
|
||||||
ui->plainTextEdit->appendPlainText(tr("Requesting ") + update_url.toString());
|
ui->plainTextEdit->appendPlainText(tr("Requesting ") + update_url.toString());
|
||||||
// netmanager->connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this,SLOT(downloadProgress(qint64, qint64)));
|
|
||||||
|
|
||||||
connect(netmanager, SIGNAL(finished(QNetworkReply *)), this, SLOT(updateFinished(QNetworkReply *)));
|
connect(netmanager, SIGNAL(finished(QNetworkReply *)), this, SLOT(updateFinished(QNetworkReply *)));
|
||||||
|
|
||||||
@ -146,9 +144,6 @@ void UpdaterWindow::updateFinished(QNetworkReply *reply)
|
|||||||
{
|
{
|
||||||
if (reply->error() != QNetworkReply::NoError) {
|
if (reply->error() != QNetworkReply::NoError) {
|
||||||
qDebug() << "Update Check Error: "+reply->errorString();
|
qDebug() << "Update Check Error: "+reply->errorString();
|
||||||
// netmanager->disconnect(reply,
|
|
||||||
// SIGNAL(downloadProgress(qint64, qint64)), this,
|
|
||||||
// SLOT(downloadProgress(qint64, qint64)));
|
|
||||||
disconnect(netmanager, SIGNAL(finished(QNetworkReply *)), this, SLOT(updateFinished(QNetworkReply *)));
|
disconnect(netmanager, SIGNAL(finished(QNetworkReply *)), this, SLOT(updateFinished(QNetworkReply *)));
|
||||||
mainwin->Notify(tr("SleepyHead Updates are currently unvailable for this platform"),tr("SleepyHead Updates"));
|
mainwin->Notify(tr("SleepyHead Updates are currently unvailable for this platform"),tr("SleepyHead Updates"));
|
||||||
} else {
|
} else {
|
||||||
@ -160,15 +155,12 @@ void UpdaterWindow::updateFinished(QNetworkReply *reply)
|
|||||||
QTimer::singleShot(100, this, SLOT(downloadUpdateXML()));
|
QTimer::singleShot(100, this, SLOT(downloadUpdateXML()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// netmanager->disconnect(reply,
|
|
||||||
// SIGNAL(downloadProgress(qint64, qint64)), this,
|
|
||||||
// SLOT(downloadProgress(qint64, qint64)));
|
|
||||||
disconnect(netmanager, SIGNAL(finished(QNetworkReply *)), this, SLOT(updateFinished(QNetworkReply *)));
|
disconnect(netmanager, SIGNAL(finished(QNetworkReply *)), this, SLOT(updateFinished(QNetworkReply *)));
|
||||||
|
|
||||||
|
|
||||||
ui->plainTextEdit->appendPlainText(tr("%1 bytes received").arg(reply->size()));
|
ui->plainTextEdit->appendPlainText(tr("%1 bytes received").arg(reply->size()));
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WIN32
|
||||||
QString filename = QApplication::applicationDirPath() + "/Updates.xml";
|
QString filename = QApplication::applicationDirPath() + "/Updates.xml";
|
||||||
#else
|
#else
|
||||||
QString filename = QApplication::applicationDirPath() + QString("/LatestVersion-%1").arg(platformStr());
|
QString filename = QApplication::applicationDirPath() + QString("/LatestVersion-%1").arg(platformStr());
|
||||||
@ -181,7 +173,7 @@ void UpdaterWindow::updateFinished(QNetworkReply *reply)
|
|||||||
file.close();
|
file.close();
|
||||||
file.open(QFile::ReadOnly);
|
file.open(QFile::ReadOnly);
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WIN32
|
||||||
ParseUpdatesXML(&file);
|
ParseUpdatesXML(&file);
|
||||||
#else
|
#else
|
||||||
ParseLatestVersion(&file);
|
ParseLatestVersion(&file);
|
||||||
@ -193,7 +185,7 @@ void UpdaterWindow::updateFinished(QNetworkReply *reply)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdaterWindow::dataReceived()
|
/*void UpdaterWindow::dataReceived()
|
||||||
{
|
{
|
||||||
QString rs = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString();
|
QString rs = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString();
|
||||||
|
|
||||||
@ -267,7 +259,7 @@ void UpdaterWindow::requestFile()
|
|||||||
connect(reply, SIGNAL(readyRead()), this, SLOT(dataReceived()));
|
connect(reply, SIGNAL(readyRead()), this, SLOT(dataReceived()));
|
||||||
connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64,
|
connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64,
|
||||||
qint64)));
|
qint64)));
|
||||||
}
|
} */
|
||||||
|
|
||||||
int checkVersionStatus(QString statusstr)
|
int checkVersionStatus(QString statusstr)
|
||||||
{
|
{
|
||||||
@ -435,7 +427,7 @@ void StartMaintenanceTool()
|
|||||||
{
|
{
|
||||||
QString mt_path = QApplication::applicationDirPath()+"/MaintenanceTool.exe";
|
QString mt_path = QApplication::applicationDirPath()+"/MaintenanceTool.exe";
|
||||||
SpawnApp(mt_path);
|
SpawnApp(mt_path);
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WIN32
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -516,7 +508,7 @@ void UpdaterWindow::ParseUpdatesXML(QIODevice *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Old
|
// Old
|
||||||
void UpdaterWindow::ParseUpdateXML(QIODevice *dev)
|
/*void UpdaterWindow::ParseUpdateXML(QIODevice *dev)
|
||||||
{
|
{
|
||||||
QXmlInputSource src(dev);
|
QXmlInputSource src(dev);
|
||||||
QXmlSimpleReader reader;
|
QXmlSimpleReader reader;
|
||||||
@ -856,14 +848,14 @@ void UpdaterWindow::replyFinished(QNetworkReply *reply)
|
|||||||
mainwin->Notify(tr("There was an error completing a network request:\n\n(") + reply->errorString()
|
mainwin->Notify(tr("There was an error completing a network request:\n\n(") + reply->errorString()
|
||||||
+ ")");
|
+ ")");
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
void UpdaterWindow::on_CloseButton_clicked()
|
void UpdaterWindow::on_CloseButton_clicked()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdaterWindow::upgradeNext()
|
/*void UpdaterWindow::upgradeNext()
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item;
|
QTableWidgetItem *item;
|
||||||
bool fnd = false;
|
bool fnd = false;
|
||||||
@ -950,7 +942,7 @@ void UpdaterWindow::on_upgradeButton_clicked()
|
|||||||
|
|
||||||
ui->stackedWidget->setCurrentIndex(1);
|
ui->stackedWidget->setCurrentIndex(1);
|
||||||
upgradeNext();
|
upgradeNext();
|
||||||
}
|
} */
|
||||||
|
|
||||||
void UpdaterWindow::on_FinishedButton_clicked()
|
void UpdaterWindow::on_FinishedButton_clicked()
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* UpdaterWindow
|
/* UpdaterWindow
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
||||||
*
|
*
|
||||||
@ -50,24 +50,24 @@ class UpdaterWindow : public QMainWindow
|
|||||||
/*! \fn ParseUpdateXML(QIODevice * dev)
|
/*! \fn ParseUpdateXML(QIODevice * dev)
|
||||||
\brief Parses the update.xml from either QFile or QNetworkReply source
|
\brief Parses the update.xml from either QFile or QNetworkReply source
|
||||||
*/
|
*/
|
||||||
void ParseUpdateXML(QIODevice *dev);
|
//void ParseUpdateXML(QIODevice *dev);
|
||||||
void ParseUpdatesXML(QIODevice *dev);
|
void ParseUpdatesXML(QIODevice *dev);
|
||||||
void ParseLatestVersion(QIODevice *dev);
|
void ParseLatestVersion(QIODevice *dev);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void updateFinished(QNetworkReply *reply);
|
void updateFinished(QNetworkReply *reply);
|
||||||
|
|
||||||
//! \brief Network reply completed
|
// //! \brief Network reply completed
|
||||||
void replyFinished(QNetworkReply *reply);
|
//void replyFinished(QNetworkReply *reply);
|
||||||
|
|
||||||
//! \brief Update the progress bars as data is received
|
////! \brief Update the progress bars as data is received
|
||||||
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
//void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
||||||
|
|
||||||
//! \brief Save incomming data
|
////! \brief Save incomming data
|
||||||
void dataReceived();
|
//void dataReceived();
|
||||||
|
|
||||||
//! \brief Request a file to download
|
// //! \brief Request a file to download
|
||||||
void requestFile();
|
// void requestFile();
|
||||||
|
|
||||||
//! \brief Request the update.xml file
|
//! \brief Request the update.xml file
|
||||||
void downloadUpdateXML();
|
void downloadUpdateXML();
|
||||||
@ -76,11 +76,11 @@ class UpdaterWindow : public QMainWindow
|
|||||||
//! \brief Just close the Updater window
|
//! \brief Just close the Updater window
|
||||||
void on_CloseButton_clicked();
|
void on_CloseButton_clicked();
|
||||||
|
|
||||||
//! \brief Start processing the download que, and applying the updates
|
// //! \brief Start processing the download que, and applying the updates
|
||||||
void on_upgradeButton_clicked();
|
// void on_upgradeButton_clicked();
|
||||||
|
|
||||||
//! \brief Selects the next file in the download queue
|
// //! \brief Selects the next file in the download queue
|
||||||
void upgradeNext();
|
// void upgradeNext();
|
||||||
|
|
||||||
//! \brief Click on finished, restart if app has been upgraded, otherwise just close the window.
|
//! \brief Click on finished, restart if app has been upgraded, otherwise just close the window.
|
||||||
void on_FinishedButton_clicked();
|
void on_FinishedButton_clicked();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* SleepyHead Logger module implementation
|
/* SleepyHead Logger module implementation
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
||||||
*
|
*
|
||||||
@ -10,22 +10,12 @@
|
|||||||
|
|
||||||
QThreadPool * otherThreadPool = NULL;
|
QThreadPool * otherThreadPool = NULL;
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
||||||
void MyOutputHandler(QtMsgType type, const char *msgtxt)
|
|
||||||
{
|
|
||||||
|
|
||||||
#else
|
|
||||||
void MyOutputHandler(QtMsgType type, const QMessageLogContext &context, const QString &msgtxt)
|
void MyOutputHandler(QtMsgType type, const QMessageLogContext &context, const QString &msgtxt)
|
||||||
{
|
{
|
||||||
Q_UNUSED(context)
|
Q_UNUSED(context)
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!logger) {
|
if (!logger) {
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
fprintf(stderr, "Pre/Post: %s\n", msgtxt.toLocal8Bit().constData());
|
fprintf(stderr, "Pre/Post: %s\n", msgtxt.toLocal8Bit().constData());
|
||||||
#else
|
|
||||||
fprintf(stderr, "Pre/Post: %s\n", msgtxt);
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,18 +39,15 @@ void MyOutputHandler(QtMsgType type, const QMessageLogContext &context, const QS
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
msg = typestr + msgtxt; //+QString(" (%1:%2, %3)").arg(context.file).arg(context.line).arg(context.function);
|
||||||
msg = typestr +
|
|
||||||
msgtxt; //+QString(" (%1:%2, %3)").arg(context.file).arg(context.line).arg(context.function);
|
|
||||||
#else
|
|
||||||
msg = typestr + msgtxt;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (logger && logger->isRunning()) {
|
if (logger && logger->isRunning()) {
|
||||||
logger->append(msg);
|
logger->append(msg);
|
||||||
} else {
|
|
||||||
fprintf(stderr, "%s\n", msg.toLocal8Bit().data());
|
|
||||||
}
|
}
|
||||||
|
//else {
|
||||||
|
fprintf(stderr, "%s\n", msg.toLocal8Bit().data());
|
||||||
|
// }
|
||||||
|
|
||||||
if (type == QtFatalMsg) {
|
if (type == QtFatalMsg) {
|
||||||
abort();
|
abort();
|
||||||
|
@ -1615,15 +1615,13 @@ void MainWindow::on_action_CycleTabs_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionOnline_Users_Guide_triggered()
|
void MainWindow::on_actionOnline_Users_Guide_triggered()
|
||||||
{
|
{
|
||||||
ui->webView->load(
|
ui->webView->load(QUrl("http://sleepyhead.sourceforge.net/wiki/index.php?title=SleepyHead_Users_Guide"));
|
||||||
QUrl("http://sleepyhead.sourceforge.net/wiki/index.php?title=SleepyHead_Users_Guide"));
|
|
||||||
ui->tabWidget->setCurrentWidget(ui->helpTab);
|
ui->tabWidget->setCurrentWidget(ui->helpTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_action_Frequently_Asked_Questions_triggered()
|
void MainWindow::on_action_Frequently_Asked_Questions_triggered()
|
||||||
{
|
{
|
||||||
ui->webView->load(
|
ui->webView->load(QUrl("http://sleepyhead.sourceforge.net/wiki/index.php?title=Frequently_Asked_Questions"));
|
||||||
QUrl("http://sleepyhead.sourceforge.net/wiki/index.php?title=Frequently_Asked_Questions"));
|
|
||||||
ui->tabWidget->setCurrentWidget(ui->helpTab);
|
ui->tabWidget->setCurrentWidget(ui->helpTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1639,7 +1637,6 @@ void packEventList(EventList *el, EventDataType minval = 0)
|
|||||||
qint64 lasttime = 0;
|
qint64 lasttime = 0;
|
||||||
EventDataType min = 999, max = 0;
|
EventDataType min = 999, max = 0;
|
||||||
|
|
||||||
|
|
||||||
for (quint32 i = 0; i < el->count(); i++) {
|
for (quint32 i = 0; i < el->count(); i++) {
|
||||||
t = el->data(i);
|
t = el->data(i);
|
||||||
ti = el->time(i);
|
ti = el->time(i);
|
||||||
|
@ -293,9 +293,9 @@ mac {
|
|||||||
QMAKE_BUNDLE_DATA += TransFiles
|
QMAKE_BUNDLE_DATA += TransFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
include(../3rdparty/quazip/quazip/quazip.pri)
|
#include(../3rdparty/quazip/quazip/quazip.pri)
|
||||||
INCLUDEPATH += $$PWD/../3rdparty/quazip
|
#INCLUDEPATH += $$PWD/../3rdparty/quazip
|
||||||
DEPENDPATH += $$PWD/../3rdparty/quazip
|
#DEPENDPATH += $$PWD/../3rdparty/quazip
|
||||||
|
|
||||||
DISTFILES += \
|
DISTFILES += \
|
||||||
../README
|
../README
|
||||||
|
Loading…
Reference in New Issue
Block a user