Skip to content

Commit

Permalink
Merge branch 'master' into fix_language
Browse files Browse the repository at this point in the history
  • Loading branch information
CoBC authored Sep 30, 2024
2 parents 1034d80 + 707ec4e commit b2b400b
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 37 deletions.
1 change: 1 addition & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions Client/qtTeamTalk/changestatusdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion Client/qtTeamTalk/chattextedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Client/qtTeamTalk/filesmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand Down
4 changes: 2 additions & 2 deletions Client/qtTeamTalk/filetransferdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 7 additions & 3 deletions Client/qtTeamTalk/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)}}));
}
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down
5 changes: 5 additions & 0 deletions Client/qtTeamTalk/preferencesdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
37 changes: 19 additions & 18 deletions Client/qtTeamTalk/serverstatsdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "serverstatsdlg.h"
#include "appinfo.h"
#include "utilui.h"

#include <QTimer>

Expand Down Expand Up @@ -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;
Expand All @@ -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));

Expand Down
22 changes: 11 additions & 11 deletions Client/qtTeamTalk/utilui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Client/qtTeamTalk/utilui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit b2b400b

Please sign in to comment.