diff --git a/src/Config.cpp b/src/Config.cpp
index c1649961f..b5e1b7a1c 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -34,6 +34,8 @@ with this program. If not, see
#include "Config.h"
#include "Utils.h"
+#define QT_TO_UTF8(str) str.toUtf8().constData()
+
Config* Config::_instance = new Config();
Config::Config() :
@@ -62,9 +64,9 @@ Config::Config() :
config_set_default_bool(obsConfig,
SECTION_NAME, PARAM_AUTHREQUIRED, AuthRequired);
config_set_default_string(obsConfig,
- SECTION_NAME, PARAM_SECRET, qstring_data_copy(Secret));
+ SECTION_NAME, PARAM_SECRET, QT_TO_UTF8(Secret));
config_set_default_string(obsConfig,
- SECTION_NAME, PARAM_SALT, qstring_data_copy(Salt));
+ SECTION_NAME, PARAM_SALT, QT_TO_UTF8(Salt));
}
mbedtls_entropy_init(&entropy);
@@ -104,9 +106,9 @@ void Config::Save() {
config_set_bool(obsConfig, SECTION_NAME, PARAM_AUTHREQUIRED, AuthRequired);
config_set_string(obsConfig, SECTION_NAME, PARAM_SECRET,
- qstring_data_copy(Secret));
+ QT_TO_UTF8(Secret));
config_set_string(obsConfig, SECTION_NAME, PARAM_SALT,
- qstring_data_copy(Salt));
+ QT_TO_UTF8(Salt));
config_save(obsConfig);
}
diff --git a/src/Utils.cpp b/src/Utils.cpp
index b4cd387b1..05a0300e8 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -28,13 +28,6 @@ with this program. If not, see
Q_DECLARE_METATYPE(OBSScene);
-const char* qstring_data_copy(QString value) {
- QByteArray stringData = value.toUtf8();
- const char* constStringData = new const char[stringData.size()]();
- memcpy((void*)constStringData, stringData.constData(), stringData.size());
- return constStringData;
-}
-
obs_data_array_t* Utils::StringListToArray(char** strings, char* key) {
if (!strings)
return obs_data_array_create();
diff --git a/src/Utils.h b/src/Utils.h
index e69aa8060..f1dd8ac17 100644
--- a/src/Utils.h
+++ b/src/Utils.h
@@ -32,8 +32,6 @@ with this program. If not, see
#include
#include
-const char* qstring_data_copy(QString value);
-
class Utils {
public:
static obs_data_array_t* StringListToArray(char** strings, char* key);
diff --git a/src/forms/settings-dialog.cpp b/src/forms/settings-dialog.cpp
index 059ba4e34..557744cec 100644
--- a/src/forms/settings-dialog.cpp
+++ b/src/forms/settings-dialog.cpp
@@ -22,7 +22,6 @@ with this program. If not, see
#include "../Config.h"
#include "../WSServer.h"
#include "settings-dialog.h"
-#include "ui_settings-dialog.h"
#define CHANGE_ME "changeme"
diff --git a/src/forms/settings-dialog.h b/src/forms/settings-dialog.h
index 1043926f0..3b0f2bbfd 100644
--- a/src/forms/settings-dialog.h
+++ b/src/forms/settings-dialog.h
@@ -21,9 +21,7 @@ with this program. If not, see
#include
-namespace Ui {
-class SettingsDialog;
-}
+#include "ui_settings-dialog.h"
class SettingsDialog : public QDialog
{