diff --git a/Graphs/gGraphView.cpp b/Graphs/gGraphView.cpp index e1678ca7..7c8db147 100644 --- a/Graphs/gGraphView.cpp +++ b/Graphs/gGraphView.cpp @@ -142,7 +142,7 @@ void GetTextExtent(QString text, int & width, int & height, QFont *font) mut.lock(); #endif QFontMetrics fm(*font); -//#ifdef Q_WS_WIN32 +//#ifdef Q_OS_WIN32 QRect r=fm.tightBoundingRect(text); width=r.width(); height=r.height(); diff --git a/Resources.qrc b/Resources.qrc index 0c498c64..f10c0bf0 100644 --- a/Resources.qrc +++ b/Resources.qrc @@ -43,5 +43,6 @@ icons/sheep.png docs/update_notes.html docs/sheep.png + icons/Bob Strikes Back.png diff --git a/SleepLib/loader_plugins/cms50_loader.cpp b/SleepLib/loader_plugins/cms50_loader.cpp index e27229bb..a8ad64b5 100644 --- a/SleepLib/loader_plugins/cms50_loader.cpp +++ b/SleepLib/loader_plugins/cms50_loader.cpp @@ -191,7 +191,7 @@ bool CMS50Loader::OpenSPORFile(QString path,Machine *mach,Profile *profile) QDate d2=date.date(); if (d2.year()<2000) { // Nice to see CMS50 is Y2K friendly.. - d2.setYMD(d2.year()+100,d2.month(),d2.day()); + d2.setDate(d2.year()+100,d2.month(),d2.day()); date.setDate(d2); } if (!date.isValid()) { diff --git a/SleepLib/loader_plugins/resmed_loader.cpp b/SleepLib/loader_plugins/resmed_loader.cpp index 1eb8157e..8c217f60 100644 --- a/SleepLib/loader_plugins/resmed_loader.cpp +++ b/SleepLib/loader_plugins/resmed_loader.cpp @@ -116,7 +116,7 @@ bool EDFParser::Parse() //startDate.toTimeSpec(Qt::UTC); QDate d2=startDate.date(); if (d2.year()<2000) { - d2.setYMD(d2.year()+100,d2.month(),d2.day()); + d2.setDate(d2.year()+100,d2.month(),d2.day()); startDate.setDate(d2); } if (!startDate.isValid()) { diff --git a/SleepLib/machine_loader.h b/SleepLib/machine_loader.h index 52cacc5b..96c1de4d 100644 --- a/SleepLib/machine_loader.h +++ b/SleepLib/machine_loader.h @@ -12,7 +12,7 @@ License: GPL #include "profiles.h" #include "machine.h" -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN // Windows just needs the headers #include "../quazip/zlib.h" #else diff --git a/SleepLib/preferences.cpp b/SleepLib/preferences.cpp index f809f7f0..633e4ecc 100644 --- a/SleepLib/preferences.cpp +++ b/SleepLib/preferences.cpp @@ -17,7 +17,7 @@ License: GPL #include #include #include -#ifdef Q_WS_WIN32 +#ifdef Q_OS_WIN32 #include "windows.h" #include "lmcons.h" #endif @@ -32,7 +32,7 @@ const QString & getUserName() if (userName.isEmpty()) { userName=QObject::tr("Windows User"); -#if defined (Q_WS_WIN32) +#if defined (Q_OS_WIN32) #if defined(UNICODE) if (QSysInfo::WindowsVersion >= QSysInfo::WV_NT) { TCHAR winUserName[UNLEN + 1]; // UNLEN is defined in LMCONS.H @@ -60,9 +60,14 @@ QString GetAppRoot() QString HomeAppRoot=settings.value("Settings/AppRoot").toString(); - // Should it go here: QDesktopServices::DataLocation ??? +#if QT_VERSION < QT_VERSION_CHECK(5,0,0) + const QString desktopFolder=QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); +#else + const QString desktopFolder=QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); +#endif + if (HomeAppRoot.isEmpty()) - HomeAppRoot=QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)+"/"+AppRoot; + HomeAppRoot=desktopFolder+"/"+AppRoot; return HomeAppRoot; } diff --git a/common_gui.cpp b/common_gui.cpp index 63def571..78450932 100644 --- a/common_gui.cpp +++ b/common_gui.cpp @@ -11,7 +11,7 @@ #include #endif -#ifdef Q_WS_WIN32 +#ifdef Q_OS_WIN32 #include "windows.h" void sh_delay(int ms) { @@ -46,7 +46,7 @@ Qt::DayOfWeek firstDayOfWeekFromLocale() #endif -#ifdef Q_WS_WIN32 +#ifdef Q_OS_WIN32 #include #endif diff --git a/icons/Bob Strikes Back.png b/icons/Bob Strikes Back.png new file mode 100644 index 00000000..accec98b Binary files /dev/null and b/icons/Bob Strikes Back.png differ diff --git a/main.cpp b/main.cpp index f4fc643e..63ef5bf9 100644 --- a/main.cpp +++ b/main.cpp @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) for (int i=1;i= QT_VERSION_CHECK(5,0,0) +#if QT_VERSION < QT_VERSION_CHECK(5,0,0) // qInstallMessageHandler(MyOutputHandler); //#else qInstallMsgHandler(MyOutputHandler); -//#endif +#endif + //#endif MainWindow w; mainwin=&w; diff --git a/mainwindow.cpp b/mainwindow.cpp index 3d9c3475..9504a933 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include // Custom loaders that don't autoscan.. @@ -430,7 +431,7 @@ QString htmlHeader() "" "" "
" -"

SleepyHead v"+VersionString+"

This is a beta software and some functionality may not work as intended yet.
Please report any bugs you find to SleepyHead's SourceForge page.
" +"

SleepyHead v"+VersionString+"

This is a beta software and some functionality may not work as intended yet.
Please report any bugs you find to SleepyHead's SourceForge page.
" "
" "
"); } @@ -1487,16 +1488,72 @@ void MainWindow::on_action_About_triggered() QString gitrev=QString(GIT_REVISION); if (!gitrev.isEmpty()) gitrev="Revision: "+gitrev; - QString msg=tr("

SleepyHead v%1.%2.%3-%4 (%8)

Build Date: %5 %6
%7
Data Folder: %9
" -"Copyright ©2011 Mark Watkins (jedimark)
\n" -"http://sleepyhead.sourceforge.net
" -"This software is released under the GNU Public License
" -"This software comes with absolutely no warranty, either express of implied. It comes with no guarantee of fitness for any particular purpose. No guarantees are made regarding the accuracy of any data this program displays." - "
").arg(major_version).arg(minor_version).arg(revision_number).arg(release_number).arg(__DATE__).arg(__TIME__).arg(gitrev).arg(ReleaseStatus).arg(GetAppRoot()); + QString msg=QString("

SleepyHead v%1.%2.%3-%4 (%8)

Build Date: %5 %6
%7
Data Folder: %9


" +"Copyright ©2012 Mark Watkins (jedimark)
\n" +"http://sleepyhead.sourceforge.net
" +"http://twitter.com/jedimark64
" +"

The author wishes to express thanks to James Marshall and Rich Freeman for their assistance with this project.

" +"This software is released under the GNU Public License v3.0
" +"

This software comes with absolutely no warranty, either express of implied. It comes with no guarantee of fitness for any particular purpose. No guarantees are made regarding the accuracy of any data this program displays.

" +"

This is NOT medical software, it is merely a research tool that provides a visual interpretation of data recorded by supported devices. This software is NOT suitable for medical diagnosis, CPAP complaince reporting and other similar purposes.

" +"

The author and any associates of his accept NO responsibilty for damages, issues or non-issues resulting from the use or mis-use of this software
Use this software entirely at your own risk.

" +"

If you find this free software to be of use, please consider supporting the development efforts by making a monetary donation to the Author

" +"
").arg(major_version).arg(minor_version).arg(revision_number).arg(release_number).arg(__DATE__).arg(__TIME__).arg(gitrev).arg(ReleaseStatus).arg(GetAppRoot()); + + QDialog aboutbox; + aboutbox.setWindowTitle(QObject::tr("About SleepyHead")); + + + QVBoxLayout layout(&aboutbox); + + QPixmap pix(":/icons/Bob Strikes Back.png"); + + QTextDocument doc(this); + doc.setUndoRedoEnabled(false); + doc.setHtml(msg); + doc.setTextWidth(pix.width()); + doc.setUseDesignMetrics(true); + + doc.setDefaultTextOption(QTextOption(Qt::AlignCenter)); + + QPainter painter(&pix); + QBrush brush(QColor(255,255,255,192)); + painter.fillRect(pix.rect(),brush); + painter.setRenderHint(QPainter::Antialiasing,true); + QRect rect; + //rect.setCoords(0,200,pix.width(),550); + doc.drawContents(&painter,rect); + //painter.drawText(rect,Qt::AlignCenter | Qt::TextWordWrap,msg); + painter.end(); + + QLabel img("hello",&aboutbox); + img.setPixmap(pix); + img.setScaledContents(true); + layout.insertWidget(0,&img,1); + + QHBoxLayout layout2(&aboutbox); + layout.insertLayout(1,&layout2,1); + QPushButton okbtn(QObject::tr("&Close"),&aboutbox); + aboutbox.connect(&okbtn,SIGNAL(clicked()),SLOT(reject())); + layout2.insertWidget(1,&okbtn,1); + + QPushButton donatebtn(QObject::tr("&Donate"),&aboutbox); + aboutbox.connect(&donatebtn,SIGNAL(clicked()),SLOT(accept())); //hack this button to use the accepted slot, so clicking x closes like it shouldß + layout2.insertWidget(1,&donatebtn,1); + + QApplication::processEvents(); // MW: Needed on Mac, as the html has to finish loading + + + if (aboutbox.exec()==QDialog::Accepted) { + QDesktopServices::openUrl(QUrl("http://sourceforge.net/p/sleepyhead/donate")); + //spawn browser with paypal site. + } +/* QMessageBox msgbox(QMessageBox::Information,tr("About SleepyHead"),"",QMessageBox::Ok,this); + msgbox.setIconPixmap(); msgbox.setTextFormat(Qt::RichText); msgbox.setText(msg); - msgbox.exec(); + msgbox.exec();*/ } void MainWindow::on_actionDebug_toggled(bool checked) @@ -2694,7 +2751,7 @@ void MainWindow::on_actionImport_ZEO_Data_triggered() w.setFileMode(QFileDialog::ExistingFiles); w.setOption(QFileDialog::ShowDirsOnly, false); w.setOption(QFileDialog::DontUseNativeDialog,true); - w.setFilters(QStringList("Zeo CSV File (*.csv)")); + w.setNameFilters(QStringList("Zeo CSV File (*.csv)")); ZEOLoader zeo; if (w.exec()==QFileDialog::Accepted) { @@ -2716,7 +2773,7 @@ void MainWindow::on_actionImport_RemStar_MSeries_Data_triggered() w.setFileMode(QFileDialog::ExistingFiles); w.setOption(QFileDialog::ShowDirsOnly, false); w.setOption(QFileDialog::DontUseNativeDialog,true); - w.setFilters(QStringList("M-Series data file (*.bin)")); + w.setNameFilters(QStringList("M-Series data file (*.bin)")); MSeriesLoader mseries; if (w.exec()==QFileDialog::Accepted) { diff --git a/mainwindow.ui b/mainwindow.ui index 645a2afd..a2587e9b 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -78,7 +78,7 @@ QTabWidget::North - 1 + 0 false @@ -405,7 +405,7 @@ 1 - 1 + 0 0 @@ -416,7 +416,7 @@ 0 0 163 - 524 + 532 @@ -744,7 +744,7 @@ 0 0 178 - 313 + 326 @@ -1461,7 +1461,7 @@ 0 0 178 - 313 + 326 @@ -1545,7 +1545,7 @@ 0 0 554 - 25 + 22 @@ -1854,7 +1854,7 @@ actionE_xit - activated() + triggered() MainWindow close() @@ -1886,7 +1886,7 @@ actionView_Daily - activated() + triggered() dailyButton click() @@ -1902,7 +1902,7 @@ actionView_Overview - activated() + triggered() overviewButton click() diff --git a/overview.cpp b/overview.cpp index 7ac4a254..b2f23b93 100644 --- a/overview.cpp +++ b/overview.cpp @@ -6,7 +6,7 @@ #include #include -#include +//#include #include #include #include diff --git a/oximetry.cpp b/oximetry.cpp index 15319845..3e3c7965 100644 --- a/oximetry.cpp +++ b/oximetry.cpp @@ -939,7 +939,7 @@ void Oximetry::on_RefreshPortsButton_clicked() bool current_found=false; // Windows build mixes these up -#if defined(Q_WS_WIN32) || defined(Q_OS_MAC) +#if defined(Q_OS_WIN32) || defined(Q_OS_MAC) #define qesPORTNAME portName #else #define qesPORTNAME physName diff --git a/quazip/quazip.cpp b/quazip/quazip.cpp index 04958b4e..e13d1ce8 100644 --- a/quazip/quazip.cpp +++ b/quazip/quazip.cpp @@ -254,7 +254,7 @@ bool QuaZip::setCurrentFile(const QString& fileName, CaseSensitivity cs) } bool sens; if(cs==csDefault) { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN sens=false; #else sens=true; diff --git a/version.h b/version.h index 1b648ebb..18e673cd 100644 --- a/version.h +++ b/version.h @@ -15,7 +15,7 @@ const QString ReleaseStatus="beta"; #ifdef Q_OS_MAC const QString PlatformString="MacOSX"; -#elif defined(Q_WS_WIN32) +#elif defined(Q_OS_WIN32) const QString PlatformString="Win32"; #elif defined(Q_WS_X11) const QString PlatformString="Linux";