windows: fix invalid ringtones parameters
Also add ringtone to packaging
Refs #71986
Change-Id: I4cfa2ea99fd303f4f760b4de818374654912130a
diff --git a/RingWinClient.pro b/RingWinClient.pro
index 8423252..5d42735 100644
--- a/RingWinClient.pro
+++ b/RingWinClient.pro
@@ -76,4 +76,16 @@
DISTFILES += \
ring.wxs \
- License.rtf
+ License.rtf \
+ ringtones/konga.ul
+
+RINGTONES.files = ringtones
+release:RINGTONES.path = $$OUT_PWD/release
+
+PACKAGING.files = ring.wxs
+release:PACKAGING.path = $$OUT_PWD/release
+
+LICENSE.files = License.rtf
+release:LICENSE.path = $$OUT_PWD/release
+
+INSTALLS += RINGTONES PACKAGING LICENSE
diff --git a/configurationwidget.cpp b/configurationwidget.cpp
index 6be02e5..623e426 100644
--- a/configurationwidget.cpp
+++ b/configurationwidget.cpp
@@ -152,9 +152,10 @@
void
ConfigurationWidget::on_addAccountButton_clicked()
{
- accountModel_->add("New Account",
+ auto account = accountModel_->add("New Account",
ui->accountTypeBox->model()->index(
ui->accountTypeBox->currentIndex(), 0));
+ account->setRingtonePath(Utils::GetRingtonePath());
accountModel_->save();
}
diff --git a/ring.wxs b/ring.wxs
index a60e790..94d8793 100644
--- a/ring.wxs
+++ b/ring.wxs
@@ -52,6 +52,11 @@
<File Id='qwindowsDLL' Name='qwindows.dll' DiskId='1' Source='platforms/qwindows.dll' KeyPath='yes' />
</Component>
</Directory>
+ <Directory Id="ringtones" Name="ringtones">
+ <Component Id='RingtonesFiles' Guid='2B493BC2-281E-4B85-B93D-237DFFAD4D6E'>
+ <File Id='konga' Name='konga.ul' DiskId='1' Source='ringtones/konga.ul' KeyPath='yes' />
+ </Component>
+ </Directory>
</Directory>
</Directory>
</Directory>
@@ -76,6 +81,7 @@
<ComponentRef Id='StdLibrary' />
<ComponentRef Id='QtDeps' />
<ComponentRef Id='QtPlatformsLibrary' />
+ <ComponentRef Id='RingtonesFiles' />
<ComponentRef Id='ProgramMenuDir' />
</Feature>
</Feature>
diff --git a/ringtones/konga.ul b/ringtones/konga.ul
new file mode 100644
index 0000000..2191150
--- /dev/null
+++ b/ringtones/konga.ul
Binary files differ
diff --git a/utils.cpp b/utils.cpp
index 78d9561..5136ad8 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -79,3 +79,14 @@
return PathFileExists(linkPath.c_str());
}
+QString
+Utils::GetRingtonePath() {
+ TCHAR workingDirectory[MAX_PATH];
+ GetCurrentDirectory(MAX_PATH, workingDirectory);
+
+ QString ringtonePath = QString::fromWCharArray(workingDirectory);
+ ringtonePath += "\\ringtones\\konga.ul";
+
+ return ringtonePath;
+}
+
diff --git a/utils.h b/utils.h
index 1a79740..6d21d79 100644
--- a/utils.h
+++ b/utils.h
@@ -27,6 +27,7 @@
#include <shlwapi.h>
#include <string>
+#include <QString>
class Utils
{
@@ -35,6 +36,7 @@
static void DeleteStartupLink();
static bool CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink);
static bool CheckStartupLink();
+ static QString GetRingtonePath();
};
#endif // UTILS_H
diff --git a/wizarddialog.cpp b/wizarddialog.cpp
index bacd959..4581bac 100644
--- a/wizarddialog.cpp
+++ b/wizarddialog.cpp
@@ -25,7 +25,8 @@
void
WizardDialog::on_buttonBox_accepted()
{
- AccountModel::instance()->add(ui->usernameEdit->text(), Account::Protocol::RING);
+ auto account = AccountModel::instance()->add(ui->usernameEdit->text(), Account::Protocol::RING);
+ account->setRingtonePath(Utils::GetRingtonePath());
AccountModel::instance()->save();
Utils::CreateStartupLink();
}