Save adjusted displayTimeShift to database.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 28 Jul 2021 21:42:09 +0000 (23:42 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 28 Jul 2021 21:42:09 +0000 (23:42 +0200)
src/gui/conferenceeditor.cpp
src/gui/conferenceeditor.h

index a11eeaed7f578f8848d5bdfd380748d464b3e6b0..b1e9ffc7955f5ccab861cc0d5d199fda296252f0 100644 (file)
@@ -50,6 +50,8 @@ ConferenceEditor::ConferenceEditor(ConferenceModel* model, QWidget* parent)
     connect(changeUrl, SIGNAL(clicked()), SLOT(changeUrlClicked()));
     connect(refreshBtn, SIGNAL(clicked()), SLOT(refreshClicked()));
     connect(buttonBox, SIGNAL(rejected()), SLOT(close()));
+    connect(conferenceDtsHours, SIGNAL(valueChanged(int)), SLOT(dtsChanged()));
+    connect(conferenceDtsMinutes, SIGNAL(valueChanged(int)), SLOT(dtsChanged()));
 
     // it's OK to emit selection signals here
     // because they are not yet connected to anybody
@@ -102,6 +104,9 @@ void ConferenceEditor::itemSelected(const QModelIndex& current, const QModelInde
         } else {
             conferenceUtcOffset->setText("N/A");
         }
+        int dts = conf.displayTimeShift();
+        conferenceDtsHours->setValue(dts / 60);
+        conferenceDtsMinutes->setValue(abs(dts) % 60);
         conferenceInfo->setCurrentIndex(0);
         removeBtn->show();
     }
@@ -168,6 +173,14 @@ void ConferenceEditor::refreshClicked()
     emit haveConferenceUrl(url, selected_id);
 }
 
+void ConferenceEditor::dtsChanged() {
+    if (selected_id < 0) return;
+    Conference& conference = model->conferenceFromIndex(model->indexFromId(selected_id));
+    int minutes = conferenceDtsMinutes->value();
+    if (conferenceDtsHours->value() < 0) minutes *= -1;
+    conference.setDisplayTimeShift(conferenceDtsHours->value() * 60 + minutes);
+}
+
 void ConferenceEditor::importStarted()
 {
     addBtn->hide();
index 00d6ae1fa024e3bdcec7d656d4507654f45e813a..394bfc503ba53182598c86dbde7407a6a27cd23d 100644 (file)
@@ -64,6 +64,7 @@ private slots:
     void removeClicked();
     void changeUrlClicked();
     void refreshClicked();
+    void dtsChanged();
 
 private:
     ConferenceModel* model;