diff --git a/ChangeLog.txt b/ChangeLog.txt index 5aaa6deff..6b9c5a239 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -12,6 +12,7 @@ Default Qt Client - Fixed gender changed from female to male when migrating to 5.17 release - Fixed sound events disabled when migrating to 5.17 release - Fixed language not set at first start +- All size converted to local format Android Client - iOS Client diff --git a/Client/qtTeamTalk/changestatusdlg.cpp b/Client/qtTeamTalk/changestatusdlg.cpp index 4d313a7f4..a42433ec3 100644 --- a/Client/qtTeamTalk/changestatusdlg.cpp +++ b/Client/qtTeamTalk/changestatusdlg.cpp @@ -66,6 +66,9 @@ void ChangeStatusDlg::slotAccepted() case STATUSMODE_QUESTION : m_user.nStatusMode |= STATUSMODE_QUESTION; break; + default : + Q_ASSERT(false /* this status mode is not implemented*/); + break; } ttSettings->setValue(SETTINGS_GENERAL_STATUSMESSAGE, ui.msgEdit->text()); diff --git a/Client/qtTeamTalk/chattextedit.cpp b/Client/qtTeamTalk/chattextedit.cpp index f6cac4242..14e8c9635 100644 --- a/Client/qtTeamTalk/chattextedit.cpp +++ b/Client/qtTeamTalk/chattextedit.cpp @@ -215,7 +215,7 @@ void ChatTextEdit::joinedChannel(int channelid) appendPlainText(line); //show disk quota in red - line = tr("Disk quota: %1 KBytes").arg(chan.nDiskQuota/1024); + line = tr("Disk quota: %1").arg(getFormattedSize(chan.nDiskQuota)); format.setForeground(QBrush(Qt::darkRed)); cursor.setCharFormat(format); setTextCursor(cursor); diff --git a/Client/qtTeamTalk/filesmodel.cpp b/Client/qtTeamTalk/filesmodel.cpp index ad657075f..8251e9411 100644 --- a/Client/qtTeamTalk/filesmodel.cpp +++ b/Client/qtTeamTalk/filesmodel.cpp @@ -74,7 +74,7 @@ QVariant FilesModel::data ( const QModelIndex & index, int role /*= Qt::DisplayR case COLUMN_INDEX_NAME : return _Q(m_files[index.row()].szFileName); case COLUMN_INDEX_SIZE : - return getFormattedFileSize(m_files[index.row()].nFileSize); + return getFormattedSize(m_files[index.row()].nFileSize); case COLUMN_INDEX_OWNER : return _Q(m_files[index.row()].szUsername); case COLUMN_INDEX_UPLOADED : diff --git a/Client/qtTeamTalk/filetransferdlg.cpp b/Client/qtTeamTalk/filetransferdlg.cpp index 65b13a1d4..40d174d70 100644 --- a/Client/qtTeamTalk/filetransferdlg.cpp +++ b/Client/qtTeamTalk/filetransferdlg.cpp @@ -80,8 +80,8 @@ void FileTransferDlg::updateFileTransfer(const FileTransfer& transfer) setWindowTitle(_Q(transfer.szRemoteFileName)); ui.filenameLabel->setText(_Q(transfer.szRemoteFileName)); ui.filenameLabel->setAccessibleName(QString("%1 %2").arg(ui.label->text()).arg(_Q(transfer.szRemoteFileName))); - ui.filesizeLabel->setText(getFormattedFileSize(transfer.nFileSize)); - ui.filesizeLabel->setAccessibleName(QString("%1 %2").arg(ui.label_2->text()).arg(getFormattedFileSize(transfer.nFileSize))); + ui.filesizeLabel->setText(getFormattedSize(transfer.nFileSize)); + ui.filesizeLabel->setAccessibleName(QString("%1 %2").arg(ui.label_2->text()).arg(getFormattedSize(transfer.nFileSize))); double percent = 100.0; if(transfer.nFileSize) percent = transfer.nTransferred * 100 / transfer.nFileSize; diff --git a/Client/qtTeamTalk/mainwindow.cpp b/Client/qtTeamTalk/mainwindow.cpp index afe3422b9..0dae8eb1b 100644 --- a/Client/qtTeamTalk/mainwindow.cpp +++ b/Client/qtTeamTalk/mainwindow.cpp @@ -1295,8 +1295,8 @@ void MainWindow::clienteventCmdFileNew(const RemoteFile& file) User user; TT_GetUserByUsername(ttInst, file.szUsername, &user); QString name = m_host.username != _Q(file.szUsername)?getDisplayName(user):tr("You"); - addStatusMsg(STATUSBAR_FILE_ADD, UtilUI::getStatusBarMessage(SETTINGS_STATUSBARMSG_FILE_ADDED, {{"{filename}", _Q(file.szFileName)}, {"{user}", name}, {"{username}", _Q(user.szUsername)}, {"{filesize}", getFormattedFileSize(file.nFileSize)}})); - addTextToSpeechMessage(TTS_FILE_ADD, UtilTTS::getTTSMessage(SETTINGS_TTSMSG_FILE_ADDED, {{"{filename}", _Q(file.szFileName)}, {"{user}", name}, {"{username}", _Q(user.szUsername)}, {"{filesize}", getFormattedFileSize(file.nFileSize)}})); + addStatusMsg(STATUSBAR_FILE_ADD, UtilUI::getStatusBarMessage(SETTINGS_STATUSBARMSG_FILE_ADDED, {{"{filename}", _Q(file.szFileName)}, {"{user}", name}, {"{username}", _Q(user.szUsername)}, {"{filesize}", getFormattedSize(file.nFileSize)}})); + addTextToSpeechMessage(TTS_FILE_ADD, UtilTTS::getTTSMessage(SETTINGS_TTSMSG_FILE_ADDED, {{"{filename}", _Q(file.szFileName)}, {"{user}", name}, {"{username}", _Q(user.szUsername)}, {"{filesize}", getFormattedSize(file.nFileSize)}})); } } @@ -2309,6 +2309,10 @@ void MainWindow::hotkeyToggle(HotKeyID id, bool active) { switch(id) { + case HOTKEY_NONE : + case HOTKEY_NEXT_UNUSED : + Q_ASSERT(false /* these hotkey are not implemented*/); + break; case HOTKEY_PUSHTOTALK : pttHotKey(active); break; @@ -2419,7 +2423,7 @@ void MainWindow::timerEvent(QTimerEvent *event) int ping = stats.nUdpPingTimeMs; m_clientstats = stats; - QString status = QString("RX: %1KB TX: %2KB").arg(rx / 1024.0, 2, 'f', 2, '0').arg(tx / 1024.0, 2, 'f', 2, '0'); + QString status = QString("RX: %1 TX: %2").arg(getFormattedSize(rx)).arg(getFormattedSize(tx)); if(ping != -1) m_pinglabel->setText(QString("PING: %1").arg(ping)); diff --git a/Client/qtTeamTalk/preferencesdlg.cpp b/Client/qtTeamTalk/preferencesdlg.cpp index c3640658d..202045c9c 100644 --- a/Client/qtTeamTalk/preferencesdlg.cpp +++ b/Client/qtTeamTalk/preferencesdlg.cpp @@ -844,6 +844,11 @@ void PreferencesDlg::slotSaveChanges() switch(newsndsys) { + case SOUNDSYSTEM_NONE : + case SOUNDSYSTEM_OPENSLES_ANDROID : + case SOUNDSYSTEM_AUDIOUNIT : + Q_ASSERT(false /* these sound systems are not supported*/); + break; case SOUNDSYSTEM_WASAPI: ttSettings->setValue(SETTINGS_SOUND_SOUNDSYSTEM, SOUNDSYSTEM_WASAPI); break; diff --git a/Client/qtTeamTalk/serverstatsdlg.cpp b/Client/qtTeamTalk/serverstatsdlg.cpp index 902b11c6b..a8b978460 100644 --- a/Client/qtTeamTalk/serverstatsdlg.cpp +++ b/Client/qtTeamTalk/serverstatsdlg.cpp @@ -17,6 +17,7 @@ #include "serverstatsdlg.h" #include "appinfo.h" +#include "utilui.h" #include @@ -50,21 +51,21 @@ void ServerStatisticsDlg::slotCmdSuccess(int cmdid) void ServerStatisticsDlg::slotUpdateStats(const ServerStatistics& stats) { - ui.totalRXTXLabel->setText(QString(tr("Total RX/TX") + ": %L1 / %L2 " + tr("KBytes")) - .arg(stats.nTotalBytesRX/1024) - .arg(stats.nTotalBytesTX/1024)); - ui.voiceRXTXLabel->setText(QString(tr("Voice RX/TX") + ": %L1 / %L2 " + tr("KBytes")) - .arg(stats.nVoiceBytesRX/1024) - .arg(stats.nVoiceBytesTX/1024)); - ui.videoRXTXLabel->setText(QString(tr("Video RX/TX") + ": %L1 / %L2 " + tr("KBytes")) - .arg(stats.nVideoCaptureBytesRX/1024) - .arg(stats.nVideoCaptureBytesTX/1024)); - ui.mediafileRXTXLabel->setText(QString(tr("Media File RX/TX") + ": %L1 / %L2 " + tr("KBytes")) - .arg(stats.nMediaFileBytesRX/1024) - .arg(stats.nMediaFileBytesTX/1024)); - ui.desktopRXTXLabel->setText(QString(tr("Desktop RX/TX") + ": %L1 / %L2 " + tr("KBytes")) - .arg(stats.nDesktopBytesRX/1024) - .arg(stats.nDesktopBytesTX/1024)); + ui.totalRXTXLabel->setText(QString(tr("Total RX/TX") + ": %L1 / %L2") + .arg(getFormattedSize(stats.nTotalBytesRX)) + .arg(getFormattedSize(stats.nTotalBytesTX))); + ui.voiceRXTXLabel->setText(QString(tr("Voice RX/TX") + ": %L1 / %L2") + .arg(getFormattedSize(stats.nVoiceBytesRX)) + .arg(getFormattedSize(stats.nVoiceBytesTX))); + ui.videoRXTXLabel->setText(QString(tr("Video RX/TX") + ": %L1 / %L2") + .arg(getFormattedSize(stats.nVideoCaptureBytesRX)) + .arg(getFormattedSize(stats.nVideoCaptureBytesTX))); + ui.mediafileRXTXLabel->setText(QString(tr("Media File RX/TX") + ": %L1 / %L2") + .arg(getFormattedSize(stats.nMediaFileBytesRX)) + .arg(getFormattedSize(stats.nMediaFileBytesTX))); + ui.desktopRXTXLabel->setText(QString(tr("Desktop RX/TX") + ": %L1 / %L2") + .arg(getFormattedSize(stats.nDesktopBytesRX)) + .arg(getFormattedSize(stats.nDesktopBytesTX))); if(m_lastStats.nUptimeMSec) { qint64 diff = stats.nUptimeMSec - m_lastStats.nUptimeMSec; @@ -83,9 +84,9 @@ void ServerStatisticsDlg::slotUpdateStats(const ServerStatistics& stats) } else ui.kbpsLabel->hide(); - ui.filesRXTXLabel->setText(QString(tr("Files RX/TX") + ": %L1 / %L2 " + tr("KBytes")) - .arg(stats.nFilesRx/1024) - .arg(stats.nFilesTx/1024)); + ui.filesRXTXLabel->setText(QString(tr("Files RX/TX") + ": %L1 / %L2") + .arg(getFormattedSize(stats.nFilesRx)) + .arg(getFormattedSize(stats.nFilesTx))); ui.usersLabel->setText(QString(tr("Users served") + ": %1").arg(stats.nUsersServed)); ui.usersPeakLabel->setText(QString(tr("Users peak") + ": %1").arg(stats.nUsersPeak)); diff --git a/Client/qtTeamTalk/utilui.cpp b/Client/qtTeamTalk/utilui.cpp index 6e8630792..649c464cf 100644 --- a/Client/qtTeamTalk/utilui.cpp +++ b/Client/qtTeamTalk/utilui.cpp @@ -504,22 +504,22 @@ QString getTimestampFormat() return format; } -QString getFormattedFileSize(qint64 filesize) +QString getFormattedSize(qint64 size) { - QString formattedFileSize; + QString formattedSize; #if QT_VERSION < QT_VERSION_CHECK(5,10,0) - if (filesize >= 1024*1024*1024) - formattedFileSize = QString("%1 G").arg(Filesize/(1024*1024*1024)); - else if (filesize >= 1024*1024) - formattedFileSize = QString("%1 M").arg(filesize/(1024*1024)); - else if (filesize >= 1024) - formattedFileSize = QString("%1 K").arg(filesize/1024); + if (size >= 1024*1024*1024) + formattedSize = QString("%1 G").arg(Filesize/(1024*1024*1024)); + else if (size >= 1024*1024) + formattedSize = QString("%1 M").arg(filesize/(1024*1024)); + else if (size >= 1024) + formattedSize = QString("%1 K").arg(filesize/1024); else - formattedFileSize = QString("%1").arg(filesize); + formattedSize = QString("%1").arg(filesize); #else - formattedFileSize = QLocale().formattedDataSize(filesize, 1, QLocale::DataSizeSIFormat); + formattedSize = QLocale().formattedDataSize(size, 1, QLocale::DataSizeSIFormat); #endif - return formattedFileSize; + return formattedSize; } QString UtilUI::getDefaultValue(const QString& paramKey) diff --git a/Client/qtTeamTalk/utilui.h b/Client/qtTeamTalk/utilui.h index 7ad03c9aa..62252ad52 100644 --- a/Client/qtTeamTalk/utilui.h +++ b/Client/qtTeamTalk/utilui.h @@ -173,7 +173,7 @@ QString getLanguageDisplayName(const QString &languageCode); bool switchLanguage(const QString& language); QString getFormattedDateTime(QString originalDateTimeString, QString inputFormat); QString getTimestampFormat(); -QString getFormattedFileSize(qint64 filesize); +QString getFormattedSize(qint64 size); class UtilUI : public QObject {