Skip to content

Commit 7aa515d

Browse files
committed
start with preferences if no id provided
1 parent 3b65e48 commit 7aa515d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

main.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
#include <QApplication>
44
#include <QFile>
55
#include <QStyleFactory>
6+
#include <QSettings>
67

78
#include <gst/gst.h>
89

10+
#include "preferences.h"
11+
#include "globals.h"
12+
913
int main(int argc, char *argv[])
1014
{
1115
gst_init( &argc, &argv );
@@ -24,6 +28,14 @@ int main(int argc, char *argv[])
2428
a.setStyleSheet(css_data.readAll());
2529
css_data.close();
2630
}
31+
32+
if (QSettings().value(SETTING_SESSION_ID).toString().trimmed().isEmpty())
33+
{
34+
Preferences prefDlg(nullptr);
35+
if (prefDlg.exec() != QDialog::Accepted)
36+
return 1;
37+
}
38+
2739
MainWindow w;
2840
w.show();
2941
return QApplication::exec();

signaling_connection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class NtfySignalingConnection : public ISignalingConnection
4141
const auto message = this_guid.str() + '\n' + text;
4242

4343
char buffer[1024];
44-
sprintf(buffer, send_message_url, QSettings().value(SETTING_SESSION_ID).toString().toStdString().c_str());
44+
sprintf(buffer, send_message_url, QSettings().value(SETTING_SESSION_ID).toString().trimmed().toStdString().c_str());
4545
http(HTTP_POST, buffer, nullptr, message.c_str(), message.length());
4646
}
4747

@@ -163,7 +163,7 @@ class NtfySignalingConnection : public ISignalingConnection
163163
};
164164

165165
char buffer[1024];
166-
sprintf(buffer, recv_message_url, QSettings().value(SETTING_SESSION_ID).toString().toStdString().c_str());
166+
sprintf(buffer, recv_message_url, QSettings().value(SETTING_SESSION_ID).toString().trimmed().toStdString().c_str());
167167
http(HTTP_GET, buffer, headers, nullptr, 0, on_data, verify_sse_response, progress_callback);
168168
};
169169

0 commit comments

Comments
 (0)