Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package QTalarm for openSUSE:Factory checked 
in at 2021-10-18 21:59:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/QTalarm (Old)
 and      /work/SRC/openSUSE:Factory/.QTalarm.new.1890 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "QTalarm"

Mon Oct 18 21:59:22 2021 rev:5 rq:925846 version:2.2.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/QTalarm/QTalarm.changes  2020-12-02 
13:59:07.913858705 +0100
+++ /work/SRC/openSUSE:Factory/.QTalarm.new.1890/QTalarm.changes        
2021-10-18 22:02:13.850095250 +0200
@@ -1,0 +2,9 @@
+Sun Oct 17 13:45:47 UTC 2021 - Martin Hauke <mar...@gmx.de>
+
+- Update to version 2.2.0
+  * Added ???Solve to Snooze??? feature. This forces a user to solve
+    a random math problem to stop the current alarm. This is
+    intended for those who tend to hit snooze in their sleep.
+  * Fix URL
+
+-------------------------------------------------------------------

Old:
----
  QTalarm-2.1.1.tar.gz

New:
----
  QTalarm-2.2.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ QTalarm.spec ++++++
--- /var/tmp/diff_new_pack.Gu8eLu/_old  2021-10-18 22:02:14.258095545 +0200
+++ /var/tmp/diff_new_pack.Gu8eLu/_new  2021-10-18 22:02:14.262095548 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package QTalarm
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,12 +18,12 @@
 
 %define  _name  qtalarm
 Name:           QTalarm
-Version:        2.1.1
+Version:        2.2.0
 Release:        0
 Summary:        A handy alarm clock Program written in QT
 License:        GPL-3.0-only
 Group:          Productivity/Office/Other
-URL:            https://www.random-hackery.net/qtalarm
+URL:            https://random-hackery.net/page/qtalarm/
 Source:         
https://github.com/CountMurphy/QTalarm/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
 BuildRequires:  cmake
 BuildRequires:  hicolor-icon-theme

++++++ QTalarm-2.1.1.tar.gz -> QTalarm-2.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/QTalarm.pro 
new/QTalarm-2.2.0/QTalarm.pro
--- old/QTalarm-2.1.1/QTalarm.pro       2020-11-30 18:31:18.000000000 +0100
+++ new/QTalarm-2.2.0/QTalarm.pro       2021-10-06 03:50:21.000000000 +0200
@@ -13,6 +13,7 @@
 
 
 SOURCES += main.cpp\
+    bastardsnooze.cpp \
         mainwindow.cpp \
     timer.cpp \
     alarm.cpp \
@@ -24,6 +25,7 @@
     settingdialog.cpp
 
 HEADERS  += mainwindow.h \
+    bastardsnooze.h \
     timer.h \
     alarm.h \
     fileio.h \
@@ -35,6 +37,7 @@
 
 FORMS    += mainwindow.ui \
     aboutdialog.ui \
+    bastardsnooze.ui \
     snooze.ui \
     settingdialog.ui
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/aboutdialog.h 
new/QTalarm-2.2.0/aboutdialog.h
--- old/QTalarm-2.1.1/aboutdialog.h     2020-11-30 18:31:18.000000000 +0100
+++ new/QTalarm-2.2.0/aboutdialog.h     2021-10-06 03:50:21.000000000 +0200
@@ -14,7 +14,7 @@
 public:
     explicit AboutDialog(QWidget *parent = 0);
     ~AboutDialog();
-    const QString version="2.1.1";
+    const QString version="2.2.0";
     
 private:
     Ui::AboutDialog *ui;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/alarm.h new/QTalarm-2.2.0/alarm.h
--- old/QTalarm-2.1.1/alarm.h   2020-11-30 18:31:18.000000000 +0100
+++ new/QTalarm-2.2.0/alarm.h   2021-10-06 03:50:21.000000000 +0200
@@ -10,14 +10,21 @@
 {
     Q_OBJECT
 public:
-    explicit Alarm(QObject *parent = 0);
+    virtual ~Alarm(){};
+    static Alarm & GetInstance()
+    {
+        static Alarm instance;
+        return instance;
+    }
     void Start(bool useCustom);
     void Stop();
     bool isPlaying();
     bool canResume;
     void SetCustomPath(QString);
     bool UsingCustomPath;
+    bool isBastard;
 private:
+    explicit Alarm(QObject *parent = 0);
     QMediaPlayer * media;
     QString _DefaultPath;
     QString _CustPath;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/bastardsnooze.cpp 
new/QTalarm-2.2.0/bastardsnooze.cpp
--- old/QTalarm-2.1.1/bastardsnooze.cpp 1970-01-01 01:00:00.000000000 +0100
+++ new/QTalarm-2.2.0/bastardsnooze.cpp 2021-10-06 03:50:21.000000000 +0200
@@ -0,0 +1,74 @@
+#include "bastardsnooze.h"
+#include "ui_bastardsnooze.h"
+#include <QRandomGenerator>
+#include <QDateTime>
+#include <QMessageBox>
+#include <QCloseEvent>
+
+BastardSnooze::BastardSnooze(QWidget *parent, Alarm * curAlarm) :
+    QMainWindow(parent),
+    ui(new Ui::BastardSnooze)
+{
+    ui->setupUi(this);
+    QRandomGenerator *generator=new QRandomGenerator();
+    generator->seed(QDateTime::currentSecsSinceEpoch());
+    val1 = generator->bounded(13);
+    val2 = generator->bounded(13);
+    randOp = generator->bounded(3);
+    this->ui->num1->setProperty("value",val1);
+    this->ui->num2->setProperty("value",val2);
+    switch(randOp)
+    {
+    case 0:
+        this->ui->Operator->setText("+");
+        break;
+    case 1:
+        this->ui->Operator->setText("-");
+        break;
+    case 2:
+        this->ui->Operator->setText("X");
+        break;
+    }
+
+    this->_curAlarm=curAlarm;
+
+    //connect btn
+    connect(ui->okbtn,SIGNAL(clicked()),this,SLOT(checkMath()));
+    connect(ui->Ans,SIGNAL(returnPressed()),this,SLOT(checkMath()));
+}
+
+void BastardSnooze::checkMath()
+{
+    bool retVal=false;
+    switch (randOp) {
+    case 0:
+        retVal=val1+val2==ui->Ans->text().toInt();
+        break;
+    case 1:
+        retVal=val1-val2==ui->Ans->text().toInt();
+        break;
+    case 2:
+        retVal=val1*val2==ui->Ans->text().toInt();
+        break;
+    }
+    if(retVal)
+    {
+        this->_curAlarm->Stop();
+        this->hide();
+        this->~BastardSnooze();
+    }else{
+        QMessageBox::critical(this,"WRONG","WRONG");
+    }
+}
+
+BastardSnooze::~BastardSnooze()
+{
+    delete ui;
+    this->deleteLater();
+}
+
+void BastardSnooze::closeEvent(QCloseEvent *event)
+{
+    event->ignore();
+    QMessageBox::warning(this,"Nope","you didn't think it was going to be that 
easy did you?");
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/bastardsnooze.h 
new/QTalarm-2.2.0/bastardsnooze.h
--- old/QTalarm-2.1.1/bastardsnooze.h   1970-01-01 01:00:00.000000000 +0100
+++ new/QTalarm-2.2.0/bastardsnooze.h   2021-10-06 03:50:21.000000000 +0200
@@ -0,0 +1,30 @@
+#ifndef BASTARDSNOOZE_H
+#define BASTARDSNOOZE_H
+
+#include <QMainWindow>
+#include "alarm.h"
+
+namespace Ui {
+class BastardSnooze;
+}
+
+class BastardSnooze : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    explicit BastardSnooze(QWidget *parent = nullptr, Alarm * curAlarm=0);
+    ~BastardSnooze();
+
+private:
+    Ui::BastardSnooze *ui;
+    qint32 val1;
+    qint32 val2;
+    qint32 randOp;
+    Alarm * _curAlarm;
+    void closeEvent(QCloseEvent*);
+private slots:
+    void checkMath();
+};
+
+#endif // BASTARDSNOOZE_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/bastardsnooze.ui 
new/QTalarm-2.2.0/bastardsnooze.ui
--- old/QTalarm-2.1.1/bastardsnooze.ui  1970-01-01 01:00:00.000000000 +0100
+++ new/QTalarm-2.2.0/bastardsnooze.ui  2021-10-06 03:50:21.000000000 +0200
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BastardSnooze</class>
+ <widget class="QMainWindow" name="BastardSnooze">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>977</width>
+    <height>332</height>
+   </rect>
+  </property>
+  <property name="focusPolicy">
+   <enum>Qt::StrongFocus</enum>
+  </property>
+  <property name="windowTitle">
+   <string>Bastard Snooze</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QLCDNumber" name="num1">
+    <property name="geometry">
+     <rect>
+      <x>210</x>
+      <y>30</y>
+      <width>171</width>
+      <height>111</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLCDNumber" name="num2">
+    <property name="geometry">
+     <rect>
+      <x>610</x>
+      <y>30</y>
+      <width>161</width>
+      <height>111</height>
+     </rect>
+    </property>
+    <property name="segmentStyle">
+     <enum>QLCDNumber::Filled</enum>
+    </property>
+   </widget>
+   <widget class="QLabel" name="Operator">
+    <property name="geometry">
+     <rect>
+      <x>450</x>
+      <y>50</y>
+      <width>91</width>
+      <height>81</height>
+     </rect>
+    </property>
+    <property name="baseSize">
+     <size>
+      <width>0</width>
+      <height>0</height>
+     </size>
+    </property>
+    <property name="font">
+     <font>
+      <pointsize>53</pointsize>
+     </font>
+    </property>
+    <property name="text">
+     <string>X</string>
+    </property>
+    <property name="alignment">
+     <set>Qt::AlignCenter</set>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="okbtn">
+    <property name="geometry">
+     <rect>
+      <x>520</x>
+      <y>220</y>
+      <width>161</width>
+      <height>51</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>OK</string>
+    </property>
+    <property name="autoDefault">
+     <bool>false</bool>
+    </property>
+    <property name="default">
+     <bool>true</bool>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="Ans">
+    <property name="geometry">
+     <rect>
+      <x>260</x>
+      <y>220</y>
+      <width>211</width>
+      <height>51</height>
+     </rect>
+    </property>
+    <property name="font">
+     <font>
+      <pointsize>50</pointsize>
+     </font>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>977</width>
+     <height>23</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/fileio.cpp new/QTalarm-2.2.0/fileio.cpp
--- old/QTalarm-2.1.1/fileio.cpp        2020-11-30 18:31:18.000000000 +0100
+++ new/QTalarm-2.2.0/fileio.cpp        2021-10-06 03:50:21.000000000 +0200
@@ -31,12 +31,6 @@
 
 QList<Schedule*> FileIO::LoadConfig()
 {
-    //Legacy save file check
-    if(this->_Settings.value("AlarmCount").isNull())
-    {
-        return LegacyRead();
-    }
-
     QList<Schedule*> scheduleList;
     QString indexStr;
 
@@ -61,6 +55,7 @@
         
sched->setIsFriEnabled(this->_Settings.value(indexStr+"FriEnabled").toBool());
         
sched->setIsSatEnabled(this->_Settings.value(indexStr+"SatEnabled").toBool());
         
sched->setIsSunEnabled(this->_Settings.value(indexStr+"SunEnabled").toBool());
+        
sched->SetIsBastard(this->_Settings.value(indexStr+"Bastard").toBool());
 
         
sched->SetCustEnabled(this->_Settings.value(indexStr+"CustEnabled").toBool());
         sched->SetCust(this->_Settings.value(indexStr+"CustDate").toDate());
@@ -93,6 +88,7 @@
             
this->_Settings.setValue(IndexStr+"FriEnabled",currentSche->isFriEnabled());
             
this->_Settings.setValue(IndexStr+"SatEnabled",currentSche->isSatEnabled());
             
this->_Settings.setValue(IndexStr+"SunEnabled",currentSche->isSunEnabled());
+            
this->_Settings.setValue(IndexStr+"Bastard",currentSche->isBastard());
             this->_Settings.setValue(IndexStr+"Time",currentSche->GetTime());
             
this->_Settings.setValue(IndexStr+"CustEnabled",currentSche->GetCustomEnabled());
             
this->_Settings.setValue(IndexStr+"CustDate",currentSche->GetCustomDate());
@@ -110,6 +106,8 @@
     return true;
 }
 
+//static lazy loaded methods
+
 
 int FileIO::LoadVolume()
 {
@@ -168,99 +166,20 @@
     return settings.value("WarnOnPm").toBool();
 }
 
+bool FileIO::LoadSeenSolveText()
+{
+    QSettings settings;
+    return settings.value("SeenSolvedText").toBool();
+}
+
 void FileIO::SaveWarnOnPm(bool warn)
 {
     QSettings settings;
     settings.setValue("WarnOnPm",warn);
 }
 
-//to be removed in future versions
-QList<Schedule*> FileIO::LegacyRead()
+void FileIO::SaveSeenSolveText()
 {
-    QList<Schedule*> convertedSche;
-
-    for(int index=0;index<5;index++)
-    {
-
-        QString Index;
-        Index.setNum(index);
-        if(this->_Settings.value(Index+"WDEnabled").toBool())
-        {
-            Schedule *newSche=new Schedule;
-            newSche->setIsMonEnabled(true);
-            newSche->setIsTueEnabled(true);
-            newSche->setIsWedEnabled(true);
-            newSche->setIsThurEnabled(true);
-            newSche->setIsFriEnabled(true);
-
-            if(this->_Settings.value(Index+"WDTime").toTime().isNull())
-            {
-                QTime emptyTime;
-                emptyTime.setHMS(0,0,0,0);
-                newSche->SetTime(emptyTime);
-            }
-            else
-            {
-                
newSche->SetTime(this->_Settings.value(Index+"WDTime").toTime());
-            }
-
-            
if(this->_Settings.value((Index+"CustomSoundEnabled")).isNull()==false)
-            {
-                
newSche->SetCustomSoundEnabled(this->_Settings.value(Index+"CustomSoundEnabled").toBool());
-                
newSche->SetCustomSound(this->_Settings.value(Index+"CustomSound").toString());
-            }
-            convertedSche.append(newSche);
-        }
-
-        if(this->_Settings.value(Index+"WEEnabled").toBool())
-        {
-            Schedule *newSche=new Schedule;
-            newSche->setIsSatEnabled(true);
-            newSche->setIsSunEnabled(true);
-
-            if(this->_Settings.value(Index+"WETime").toTime().isNull())
-            {
-                QTime emptyTime;
-                emptyTime.setHMS(0,0,0,0);
-                newSche->SetTime(emptyTime);
-            }
-            else
-            {
-                
newSche->SetTime(this->_Settings.value(Index+"WETime").toTime());
-            }
-
-            
if(this->_Settings.value((Index+"CustomSoundEnabled")).isNull()==false)
-            {
-                
newSche->SetCustomSoundEnabled(this->_Settings.value(Index+"CustomSoundEnabled").toBool());
-                
newSche->SetCustomSound(this->_Settings.value(Index+"CustomSound").toString());
-            }
-            convertedSche.append(newSche);
-        }
-
-        if(this->_Settings.value(Index+"CustEnabled").toBool())
-        {
-            Schedule *newSche=new Schedule;
-            newSche->setIsCustomEnabled(true);
-            if(this->_Settings.value(Index+"CustTime").toDateTime().isNull())
-            {
-                QTime emptyTime;
-                emptyTime.setHMS(0,0,0,0);
-                newSche->SetTime(emptyTime);
-            }else
-            {
-                QDateTime 
val=this->_Settings.value(Index+"CustTime").toDateTime();
-                newSche->SetTime(val.time());
-                newSche->SetCust(val.date());
-            }
-            
if(this->_Settings.value((Index+"CustomSoundEnabled")).isNull()==false)
-            {
-                
newSche->SetCustomSound(this->_Settings.value(Index+"CustomSound").toString());
-                
newSche->SetCustomSoundEnabled(this->_Settings.value(Index+"CustomSoundEnabled").toBool());
-            }
-            convertedSche.append(newSche);
-        }
-
-    }
-    return convertedSche;
-
+    QSettings settings;
+    settings.setValue("SeenSolvedText",true);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/fileio.h new/QTalarm-2.2.0/fileio.h
--- old/QTalarm-2.1.1/fileio.h  2020-11-30 18:31:18.000000000 +0100
+++ new/QTalarm-2.2.0/fileio.h  2021-10-06 03:50:21.000000000 +0200
@@ -22,13 +22,14 @@
     static void SaveWindowShow(bool);
     static bool isMilTime();
     static bool LoadisMono();
+    static bool LoadSeenSolveText();
     static void SaveisMono(bool);
+    static void SaveSeenSolveText();
     static void SaveisMilTime(bool isMilTime);
     static bool LoadWarnOnPm();
     static void SaveWarnOnPm(bool);
 private:
     QSettings _Settings;
-    QList<Schedule*> LegacyRead();
 signals:
     
 public slots:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/mainwindow.cpp 
new/QTalarm-2.2.0/mainwindow.cpp
--- old/QTalarm-2.1.1/mainwindow.cpp    2020-11-30 18:31:18.000000000 +0100
+++ new/QTalarm-2.2.0/mainwindow.cpp    2021-10-06 03:50:21.000000000 +0200
@@ -7,6 +7,7 @@
 #include "aboutdialog.h"
 #include "settingdialog.h"
 #include "snooze.h"
+#include "bastardsnooze.h"
 #include <QMessageBox>
 #include <QCheckBox>
 #include <QLabel>
@@ -19,6 +20,7 @@
 #include <QSystemTrayIcon>
 #include <QListWidgetItem>
 #include <QCalendarWidget>
+#include <QToolTip>
 
 MainWindow::MainWindow(QWidget *parent) :
     QMainWindow(parent),
@@ -37,6 +39,8 @@
     _Schedules->LoadSchedules();
     PopulateListWidget();
     DisablePanelIfNoSelection();
+    if(ui->listWidget->currentRow()==0)
+        ShowActiveAlarm(0);
 
     _isMilTime=FileIO::isMilTime();
     _WarnOnPm=FileIO::LoadWarnOnPm();
@@ -45,7 +49,7 @@
 
     //Call Time keeper
     TimeKeeper=new Timer(this,_Schedules);
-    CurAlarm=new Alarm(this);
+    CurAlarm = &Alarm::GetInstance();
     TimeKeeper->StartTimer(CurAlarm);
 
     //Set Volume
@@ -64,18 +68,16 @@
     trayIconMenu->addSeparator();
     trayIconMenu->addAction(QAquit);
     trayIcon->setContextMenu(trayIconMenu);
-    if(FileIO::LoadisMono())
-    {
-        trayIcon->setIcon(QIcon(":/new/icons/mono.png"));
-    }else{
-        trayIcon->setIcon(QIcon(":/new/icons/Clock.png"));
-    }
-    trayIcon->setToolTip("QTalarm");
+    ChangeIconToDefault();
     trayIcon->show();
 
     ui->txtSoundPath->setText("");
     ui->CustEdit->setDate(QDate::currentDate());
     SetupClock();
+    ui->chkBastard->setToolTip("Only stop alarms after a random math problem 
has been solved.");
+    ui->chkSounds->setToolTip("Use a custom sound/video file to wake up to");
+
+
 
 
     //set up ui slots
@@ -98,9 +100,9 @@
     connect(ui->chkSun,SIGNAL(clicked(bool)),this,SLOT(ToggleSun(bool)));
     connect(ui->chkCustom,SIGNAL(clicked(bool)),this,SLOT(ToggleCust(bool)));
     connect(ui->chkSounds,SIGNAL(clicked(bool)),this,SLOT(OpenDiaglog(bool)));
+    
connect(ui->chkBastard,SIGNAL(clicked(bool)),this,SLOT(ToggleBastard(bool)));
     connect(ui->TestBtn,SIGNAL(clicked()),this,SLOT(TestAlarm()));
     
connect(ui->VolumeSlider,SIGNAL(valueChanged(int)),CurAlarm,SLOT(SetVolume(int)));
-
     
connect(ui->calendarWidget,SIGNAL(clicked(QDate)),this,SLOT(SetCustomDate()));
 }
 
@@ -138,7 +140,7 @@
 
 void MainWindow::ToggleWindow()
 {
-    if(this->CurAlarm->isPlaying())
+    if(this->CurAlarm->isPlaying() && this->CurAlarm->isBastard==false)
     {
         this->CurAlarm->Stop();
     }
@@ -185,6 +187,15 @@
     }
 }
 
+void MainWindow::ToggleBastard(bool val)
+{
+    Schedule 
*Active=this->_Schedules->GetSchedule(ui->listWidget->currentRow());
+    Active->SetIsBastard(val);
+    UpdateListWidget();
+    this->_Schedules->Save();
+    SendTrayMessage(solveNotificationTitle,solveNotification);
+}
+
 void MainWindow::ToggleMon(bool isEnabled)
 {
     Schedule 
*Active=this->_Schedules->GetSchedule(ui->listWidget->currentRow());
@@ -239,10 +250,17 @@
 
 void MainWindow::Quit()
 {
-    this->_Schedules->Save();
-    FileIO::DelExtracted();
-    FileIO::SaveVolume(ui->VolumeSlider->value());
-    qApp->quit();
+    if(this->CurAlarm->isPlaying() && this->CurAlarm->isBastard)
+    {
+        //message box will cause app to exit even though we told it not too. 
wtf
+        //QMessageBox::warning(this,"Nope","you didn't think it was going to 
be that easy did you?");
+        return;
+    }else{
+        this->_Schedules->Save();
+        FileIO::DelExtracted();
+        FileIO::SaveVolume(ui->VolumeSlider->value());
+        qApp->quit();
+    }
 }
 
 void MainWindow::AddRemoveAlarm(QAbstractButton *button)
@@ -289,12 +307,14 @@
     ui->chkSat->setChecked(active->isSatEnabled());
     ui->chkSun->setChecked(active->isSunEnabled());
     ui->calendarWidget->setSelectedDate(active->GetCustomDate());
+    ui->chkBastard->setChecked(active->isBastard());
 }
 
 void MainWindow::timeCheck()
 {
     UpdateClock();
     SnoozeMenuCheck();
+    BastardMenuCheck();
     if(_isMilTime!=_prevTimeWasMil)
     {
         _prevTimeWasMil=_isMilTime;
@@ -330,20 +350,15 @@
 
 void MainWindow::TestAlarm()
 {
-    if(ui->TestBtn->text()=="Test" || ui->TestBtn->text()=="&Test")
+    if(ui->chkSounds->isChecked())
     {
-        if(ui->chkSounds->isChecked())
-        {
-            this->CurAlarm->SetCustomPath(ui->txtSoundPath->text());
-            this->CurAlarm->Start(true);
-        }else{
-            this->CurAlarm->Start(false);
-        }
-        ui->TestBtn->setText("Stop");
+        this->CurAlarm->SetCustomPath(ui->txtSoundPath->text());
+        this->CurAlarm->Start(true);
     }else{
-        this->CurAlarm->Stop();
-        ui->TestBtn->setText("Test");
+        this->CurAlarm->Start(false);
     }
+    CurAlarm->isBastard=this->ui->chkBastard->isChecked();
+    this->testrun=true;
 }
 
 void MainWindow::ShowAbout()
@@ -355,19 +370,34 @@
 
 void MainWindow::SnoozeMenuCheck()
 {
-    if(this->CurAlarm->isPlaying() && this->CurAlarm->canResume && 
(ui->TestBtn->text()=="Test" || ui->TestBtn->text()=="&Test"))
+    if((this->testrun==true && this->CurAlarm->isBastard==false) || 
(this->CurAlarm->isPlaying() && this->CurAlarm->canResume && 
this->CurAlarm->isBastard==false))
     {
         //Create Snooze Menu object
         snooze *snMenu=new snooze(this,CurAlarm);
         snMenu->show();
-        if(this->_supportsTray)
+        if(this->_supportsTray && this->testrun==false)
         {
             this->hide();
         }
         this->CurAlarm->canResume=false;
+        this->testrun=false;
     }
 }
 
+void MainWindow::BastardMenuCheck()
+{
+    if((this->testrun==true && this->CurAlarm->isBastard==true) || 
(this->CurAlarm->isPlaying() && this->CurAlarm->canResume &&  
this->CurAlarm->isBastard))
+    {
+        BastardSnooze *bsnooze= new BastardSnooze(this,this->CurAlarm);
+        bsnooze->show();
+        if(this->_supportsTray && this->testrun==false)
+        {
+            this->hide();
+        }
+        this->CurAlarm->canResume=false;
+        this->testrun=false;
+    }
+}
 
 void MainWindow::PMWarning()
 {
@@ -420,10 +450,12 @@
         ui->chkWed->setEnabled(false);
         ui->CustEdit->setEnabled(false);
         ui->timeEdit->setEnabled(false);
+        ui->chkBastard->setEnabled(false);
 
         ui->chkCustom->setChecked(false);
         ui->chkFri->setChecked(false);
         ui->chkMon->setChecked(false);
+        ui->chkBastard->setChecked(false);
         ui->chkSat->setChecked(false);
         ui->chkSounds->setChecked(false);
         ui->chkSun->setChecked(false);
@@ -446,6 +478,7 @@
         ui->chkWed->setEnabled(true);
         ui->CustEdit->setEnabled(true);
         ui->timeEdit->setEnabled(true);
+        ui->chkBastard->setEnabled(true);
     }
 }
 
@@ -456,3 +489,30 @@
     ui->listWidget->setCurrentRow(index);
     this->_Schedules->Save();
 }
+
+void MainWindow::SendTrayMessage(QString title, QString message)
+{
+    if(!FileIO::LoadSeenSolveText())
+    {
+        QIcon icon;
+        if(FileIO::LoadisMono())
+        {
+            icon = QIcon(":/new/icons/mono.png");
+        }else{
+            icon = QIcon(":/new/icons/Clock.png");
+        }
+        trayIcon->showMessage(title,message,icon);
+        FileIO::SaveSeenSolveText();
+    }
+}
+
+void MainWindow::ChangeIconToDefault()
+{
+    trayIcon->setToolTip("QTalarm");
+    if(FileIO::LoadisMono())
+    {
+        this->trayIcon->setIcon(QIcon(":/new/icons/mono.png"));
+    }else{
+        this->trayIcon->setIcon(QIcon(":/new/icons/Clock.png"));
+    }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/mainwindow.h 
new/QTalarm-2.2.0/mainwindow.h
--- old/QTalarm-2.1.1/mainwindow.h      2020-11-30 18:31:18.000000000 +0100
+++ new/QTalarm-2.2.0/mainwindow.h      2021-10-06 03:50:21.000000000 +0200
@@ -31,6 +31,7 @@
     bool _prevTimeWasMil;
     bool _supportsTray;
     bool _WarnOnPm;
+    bool testrun=false;
     void displayTimeMode();
 
     void closeEvent(QCloseEvent*);
@@ -40,6 +41,10 @@
     void PopulateListWidget();
     void DisablePanelIfNoSelection();
     void UpdateListWidget();
+    void ChangeIconToDefault();
+
+    QString solveNotificationTitle = "Solve To Silence";
+    QString solveNotification = "Solve to Silence is a new feature that 
prevents the user from dismissing snooze until they solve a math problem";
 
 private slots:
     void ToggleWindow();
@@ -56,13 +61,16 @@
     void ToggleSat(bool);
     void ToggleSun(bool);
     void ToggleCust(bool);
+    void ToggleBastard(bool);
     void Quit();
     void OpenDiaglog(bool);
     void TestAlarm();
     void ShowAbout();
     void SnoozeMenuCheck();
+    void BastardMenuCheck();
     void timeCheck();
     void ShowSettings();
+    void SendTrayMessage(QString title, QString message);
 };
 
 #endif // MAINWINDOW_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/mainwindow.ui 
new/QTalarm-2.2.0/mainwindow.ui
--- old/QTalarm-2.1.1/mainwindow.ui     2020-11-30 18:31:18.000000000 +0100
+++ new/QTalarm-2.2.0/mainwindow.ui     2021-10-06 03:50:21.000000000 +0200
@@ -9,7 +9,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>658</width>
+    <width>696</width>
     <height>644</height>
    </rect>
   </property>
@@ -25,9 +25,6 @@
   </property>
   <widget class="QWidget" name="centralWidget">
    <layout class="QGridLayout" name="gridLayout">
-    <item row="0" column="0" colspan="6">
-     <widget class="QCalendarWidget" name="calendarWidget"/>
-    </item>
     <item row="0" column="6" colspan="3">
      <widget class="QGroupBox" name="groupBox">
       <property name="enabled">
@@ -76,13 +73,6 @@
       </layout>
      </widget>
     </item>
-    <item row="1" column="0" colspan="2">
-     <widget class="QCheckBox" name="chkMon">
-      <property name="text">
-       <string>Monday</string>
-      </property>
-     </widget>
-    </item>
     <item row="1" column="2">
      <widget class="QCheckBox" name="chkTues">
       <property name="text">
@@ -90,17 +80,24 @@
       </property>
      </widget>
     </item>
-    <item row="1" column="4" colspan="2">
-     <widget class="QCheckBox" name="chkWed">
+    <item row="5" column="7">
+     <widget class="QSlider" name="VolumeSlider">
+      <property name="orientation">
+       <enum>Qt::Horizontal</enum>
+      </property>
+     </widget>
+    </item>
+    <item row="4" column="7">
+     <widget class="QLabel" name="label">
       <property name="text">
-       <string>Wednesday</string>
+       <string>Master Volume:</string>
       </property>
      </widget>
     </item>
-    <item row="1" column="6">
-     <widget class="QCheckBox" name="chkThurs">
+    <item row="1" column="4" colspan="2">
+     <widget class="QCheckBox" name="chkWed">
       <property name="text">
-       <string>Thursday</string>
+       <string>Wednesday</string>
       </property>
      </widget>
     </item>
@@ -111,10 +108,19 @@
       </property>
      </widget>
     </item>
-    <item row="3" column="0">
-     <widget class="QLabel" name="label_2">
-      <property name="text">
-       <string>Time:</string>
+    <item row="7" column="8">
+     <widget class="QDialogButtonBox" name="listAlmBtn">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="standardButtons">
+       <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
       </property>
      </widget>
     </item>
@@ -125,43 +131,32 @@
       </property>
      </widget>
     </item>
-    <item row="3" column="7">
-     <widget class="QPushButton" name="TestBtn">
+    <item row="3" column="0">
+     <widget class="QLabel" name="label_2">
       <property name="text">
-       <string>Test</string>
+       <string>Time:</string>
       </property>
      </widget>
     </item>
-    <item row="4" column="0" colspan="2">
-     <widget class="QCheckBox" name="chkCustom">
+    <item row="5" column="0">
+     <widget class="QCheckBox" name="chkSounds">
       <property name="text">
-       <string>Custom Date:</string>
+       <string>Use File</string>
       </property>
      </widget>
     </item>
-    <item row="4" column="2" colspan="2">
-     <widget class="QDateEdit" name="CustEdit"/>
-    </item>
-    <item row="4" column="7">
-     <widget class="QLabel" name="label">
+    <item row="1" column="0" colspan="2">
+     <widget class="QCheckBox" name="chkMon">
       <property name="text">
-       <string>Master Volume:</string>
+       <string>Monday</string>
       </property>
      </widget>
     </item>
-    <item row="5" column="0" rowspan="2" colspan="2">
-     <widget class="QCheckBox" name="chkSounds">
-      <property name="text">
-       <string>Use File</string>
-      </property>
-     </widget>
+    <item row="4" column="2" colspan="2">
+     <widget class="QDateEdit" name="CustEdit"/>
     </item>
-    <item row="5" column="7">
-     <widget class="QSlider" name="VolumeSlider">
-      <property name="orientation">
-       <enum>Qt::Horizontal</enum>
-      </property>
-     </widget>
+    <item row="7" column="0" colspan="8">
+     <widget class="QListWidget" name="listWidget"/>
     </item>
     <item row="6" column="1">
      <widget class="QLabel" name="txtSoundPath">
@@ -170,22 +165,24 @@
       </property>
      </widget>
     </item>
-    <item row="7" column="0" colspan="8">
-     <widget class="QListWidget" name="listWidget"/>
-    </item>
-    <item row="7" column="8">
-     <widget class="QDialogButtonBox" name="listAlmBtn">
-      <property name="sizePolicy">
-       <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-        <horstretch>0</horstretch>
-        <verstretch>0</verstretch>
-       </sizepolicy>
+    <item row="4" column="0" colspan="2">
+     <widget class="QCheckBox" name="chkCustom">
+      <property name="text">
+       <string>Custom Date:</string>
       </property>
-      <property name="orientation">
-       <enum>Qt::Vertical</enum>
+     </widget>
+    </item>
+    <item row="1" column="6">
+     <widget class="QCheckBox" name="chkThurs">
+      <property name="text">
+       <string>Thursday</string>
       </property>
-      <property name="standardButtons">
-       <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </widget>
+    </item>
+    <item row="3" column="7">
+     <widget class="QPushButton" name="TestBtn">
+      <property name="text">
+       <string>Test</string>
       </property>
      </widget>
     </item>
@@ -203,6 +200,22 @@
       </property>
      </widget>
     </item>
+    <item row="0" column="0" colspan="6">
+     <widget class="QCalendarWidget" name="calendarWidget"/>
+    </item>
+    <item row="5" column="2">
+     <widget class="QCheckBox" name="chkBastard">
+      <property name="cursor">
+       <cursorShape>PointingHandCursor</cursorShape>
+      </property>
+      <property name="toolTip">
+       <string extracomment="Force math questions to disable alarm"/>
+      </property>
+      <property name="text">
+       <string>Solve to Silence</string>
+      </property>
+     </widget>
+    </item>
    </layout>
   </widget>
   <widget class="QMenuBar" name="menuBar">
@@ -210,8 +223,8 @@
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>658</width>
-     <height>28</height>
+     <width>696</width>
+     <height>22</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFile">
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/schedule.cpp 
new/QTalarm-2.2.0/schedule.cpp
--- old/QTalarm-2.1.1/schedule.cpp      2020-11-30 18:31:18.000000000 +0100
+++ new/QTalarm-2.2.0/schedule.cpp      2021-10-06 03:50:21.000000000 +0200
@@ -19,6 +19,7 @@
     this->_CustomAlarm=QDate::currentDate();
     this->SetCustomSound("");
     this->SetCustomSoundEnabled(false);
+    this->SetIsBastard(false);
 }
 
 void Schedule::SetCustEnabled(bool isEnabled)
@@ -52,6 +53,10 @@
     this->_CustomSound=SoundPath;
 }
 
+void Schedule::SetIsBastard(bool isBast)
+{
+    this->_isBastard=isBast;
+}
 
 bool Schedule::GetCustomEnabled()
 {
@@ -70,6 +75,11 @@
     return this->_CustomAlarm;
 }
 
+bool Schedule::isBastard() const
+{
+    return this->_isBastard;
+}
+
 
 QString Schedule::GetCustomSound()
 {
@@ -187,6 +197,8 @@
         name.append(" Sun");
     if(this->isCustomEnabled())
         name.append("  "+this->_CustomAlarm.toString());
+    if(this->isBastard())
+        name.append(" ??");
 
     return name;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/schedule.h new/QTalarm-2.2.0/schedule.h
--- old/QTalarm-2.1.1/schedule.h        2020-11-30 18:31:18.000000000 +0100
+++ new/QTalarm-2.2.0/schedule.h        2021-10-06 03:50:21.000000000 +0200
@@ -6,6 +6,9 @@
 #include <QDateTime>
 #include <QString>
 
+//ew, why did I do this this way?
+//The entire scheduling class needs a rewrite.
+//Left over from my jr days....
 class Schedule : public QObject
 {
     Q_OBJECT
@@ -16,6 +19,7 @@
     void SetCust(QDate);
     void SetCustomSound(QString);
     void SetCustomSoundEnabled(bool);
+    void SetIsBastard(bool);
 
     bool GetCustomEnabled();
     bool GetCustomSoundEnabled();
@@ -51,6 +55,7 @@
 
     bool isCustomSoundEnabled() const;
     void setIsCustomSoundEnabled(bool isCustomSoundEnabled);
+    bool isBastard() const;
 
     QString Name();
 
@@ -67,6 +72,7 @@
     bool _isSunEnabled;
     bool _isCustomEnabled;
     bool _isCustomSoundEnabled;
+    bool _isBastard;
     
 signals:
     
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/snooze.cpp new/QTalarm-2.2.0/snooze.cpp
--- old/QTalarm-2.1.1/snooze.cpp        2020-11-30 18:31:18.000000000 +0100
+++ new/QTalarm-2.2.0/snooze.cpp        2021-10-06 03:50:21.000000000 +0200
@@ -11,12 +11,14 @@
     ui->setupUi(this);
     this->_curAlarm=curAlarm;
     this->_snoozeTimer=new QTimer(this);
+    this->_otherAlarmCheckTimer=new QTimer(this);
     this->isDismissed=false;
     SetupClock();
 
     //setup connections
     connect(ui->snzBtn,SIGNAL(clicked()),SLOT(SnoozeClicked()));
     connect(ui->DismissBtn,SIGNAL(clicked()),SLOT(DismissClicked()));
+    
connect(this->_otherAlarmCheckTimer,SIGNAL(timeout()),SLOT(OtherAlarmCheck()));
     connect(this->_snoozeTimer,SIGNAL(timeout()),SLOT(timerOut()));
 
 }
@@ -47,6 +49,7 @@
 {
     this->_snoozeTimer->start(300000);//5 minutes
     this->_curAlarm->Stop();
+    this->_otherAlarmCheckTimer->start(500);
 }
 
 void snooze::DismissClicked()
@@ -59,6 +62,18 @@
 
 void snooze::timerOut()
 {
+    this->_otherAlarmCheckTimer->stop();
     this->_curAlarm->Start(this->_curAlarm->UsingCustomPath);
     this->_curAlarm->canResume=false;
+    this->_snoozeTimer->stop();
+}
+
+void snooze::OtherAlarmCheck()
+{
+    //If another alarm is playing, destroy this snooze
+    if(this->_curAlarm->isPlaying())
+    {
+        this->hide();
+        this->~snooze();
+    }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/snooze.h new/QTalarm-2.2.0/snooze.h
--- old/QTalarm-2.1.1/snooze.h  2020-11-30 18:31:18.000000000 +0100
+++ new/QTalarm-2.2.0/snooze.h  2021-10-06 03:50:21.000000000 +0200
@@ -24,6 +24,7 @@
 private slots:
     void DismissClicked();
     void SnoozeClicked();
+    void OtherAlarmCheck();
     void timerOut();
 
 private:
@@ -31,6 +32,7 @@
     void SetupClock();
     Alarm *_curAlarm;
     QTimer *_snoozeTimer;
+    QTimer *_otherAlarmCheckTimer;
 };
 
 #endif // SNOOZE_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/QTalarm-2.1.1/timer.cpp new/QTalarm-2.2.0/timer.cpp
--- old/QTalarm-2.1.1/timer.cpp 2020-11-30 18:31:18.000000000 +0100
+++ new/QTalarm-2.2.0/timer.cpp 2021-10-06 03:50:21.000000000 +0200
@@ -28,6 +28,7 @@
         Schedule *cur_sche;
         foreach(cur_sche,this->_Schedules->GetScheduleList())
         {
+            this->_CurAlarm->isBastard=cur_sche->isBastard();
             if(cur_sche->GetCustomSoundEnabled())
             {
                 this->_CurAlarm->SetCustomPath(cur_sche->GetCustomSound());
@@ -102,6 +103,7 @@
             {
                 //Set Condtion One!
                 this->_CurAlarm->Start(cur_sche->GetCustomSoundEnabled());
+                break;
             }
         }
     }

Reply via email to