Qt: Stop using flags to represent languages

As discussed at

https://www.flagsarenotlanguages.com/blog/

and

https://ux.stackexchange.com/questions/2472/how-to-graphically-represent-a-language

Flags don't correspond to languages very well in many cases. Don't add
them to our language list.

Add the Ioninc "language" icon from https://github.com/ionic-team/ionicons
and use it for the general "Use system setting" language item.

Remove an unneeded include.
This commit is contained in:
Gerald Combs 2023-05-07 11:15:19 -07:00 committed by AndersBroman
parent fdd1863a01
commit caeedef803
16 changed files with 29 additions and 498 deletions

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="600" viewBox="0 0 50 30">
<desc>Flag of Germany</desc>
<rect id="black_stripe" width="50" height="30" y="0" x="0" fill="#000"/>
<rect id="red_stripe" width="50" height="20" y="10" x="0" fill="#D00"/>
<rect id="gold_stripe" width="50" height="10" y="20" x="0" fill="#FFCE00"/>
</svg>

Before

Width:  |  Height:  |  Size: 503 B

View File

@ -1,10 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 30" width="1200" height="600">
<clipPath id="t">
<path d="M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z"/>
</clipPath>
<path d="M0,0 v30 h60 v-30 z" fill="#00247d"/>
<path d="M0,0 L60,30 M60,0 L0,30" stroke="#fff" stroke-width="6"/>
<path d="M0,0 L60,30 M60,0 L0,30" clip-path="url(#t)" stroke="#cf142b" stroke-width="4"/>
<path d="M30,0 v30 M0,15 h60" stroke="#fff" stroke-width="10"/>
<path d="M30,0 v30 M0,15 h60" stroke="#cf142b" stroke-width="6"/>
</svg>

Before

Width:  |  Height:  |  Size: 522 B

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 58 KiB

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1000" height="700" viewBox="0 0 30 21">
<rect width="30" height="21" fill="#ED2939"/>
<rect width="20" height="21" fill="#fff"/>
<rect width="10" height="21" fill="#002395"/>
</svg>

Before

Width:  |  Height:  |  Size: 310 B

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="1500" height="1000" viewBox="0 0 30 20">
<rect width="10" height="20" fill="#009246"/>
<rect width="10" height="20" x="10" fill="#fff"/>
<rect width="10" height="20" x="20" fill="#ce2b37"/>
</svg>

Before

Width:  |  Height:  |  Size: 283 B

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="900" height="600">
<rect fill="#a0a0a0" height="600" width="900"/>
<rect fill="#fff" x="6" y="6" width="888" height="588"/>
<circle fill="#be0026" cx="450" cy="300" r="180"/>
</svg>

Before

Width:  |  Height:  |  Size: 267 B

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="447.98679"
height="416.09518"
viewBox="0 0 447.98679 416.09518"
version="1.1"
id="svg136"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs140" />
<path
d="m 446.33,385.6 -90,-218 a 22,22 0 0 0 -40.67,0 l -90,218 a 22,22 0 1 0 40.67,16.79 L 284.66,358 h 102.67 l 18.33,44.39 A 22,22 0 0 0 426,416 22,22 0 0 0 446.32,385.6 Z M 302.83,314 336,233.65 369.17,314 Z"
id="path132"
style="fill:#ffffff;fill-opacity:1" />
<path
d="m 235.84,294.92 a 22,22 0 0 0 -4.89,-30.7 c -0.2,-0.15 -15,-11.13 -36.49,-34.73 C 234.11,175.81 256.57,114.74 265.73,86 H 298 a 22,22 0 0 0 0,-44 H 182 V 22 a 22,22 0 0 0 -44,0 V 42 H 22 a 22,22 0 0 0 0,44 h 197.25 c -9.52,26.95 -27.05,69.5 -53.79,108.36 -31.41,-41.68 -43.08,-68.65 -43.17,-68.87 a 22,22 0 0 0 -40.58,17 c 0.58,1.38 14.55,34.23 52.86,83.93 0.92,1.19 1.83,2.35 2.74,3.51 -39.24,44.35 -77.74,71.86 -93.85,80.74 a 22.00126,22.00126 0 1 0 21.07,38.63 c 2.16,-1.18 48.6,-26.89 101.63,-85.59 22.52,24.08 38,35.44 38.93,36.1 a 22,22 0 0 0 30.75,-4.9 z"
id="path134"
style="fill:#ffffff;fill-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M478.33,433.6l-90-218a22,22,0,0,0-40.67,0l-90,218a22,22,0,1,0,40.67,16.79L316.66,406H419.33l18.33,44.39A22,22,0,0,0,458,464a22,22,0,0,0,20.32-30.4ZM334.83,362,368,281.65,401.17,362Z"/><path d="M267.84,342.92a22,22,0,0,0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73,39.65-53.68,62.11-114.75,71.27-143.49H330a22,22,0,0,0,0-44H214V70a22,22,0,0,0-44,0V90H54a22,22,0,0,0,0,44H251.25c-9.52,26.95-27.05,69.5-53.79,108.36-31.41-41.68-43.08-68.65-43.17-68.87a22,22,0,0,0-40.58,17c.58,1.38,14.55,34.23,52.86,83.93.92,1.19,1.83,2.35,2.74,3.51-39.24,44.35-77.74,71.86-93.85,80.74a22,22,0,1,0,21.07,38.63c2.16-1.18,48.6-26.89,101.63-85.59,22.52,24.08,38,35.44,38.93,36.1a22,22,0,0,0,30.75-4.9Z"/></svg>

After

Width:  |  Height:  |  Size: 779 B

View File

@ -1,16 +1,6 @@
<RCC>
<qresource prefix="/languages">
<file>de.svg</file>
<file>en.svg</file>
<file>es.svg</file>
<file>fr.svg</file>
<file>it.svg</file>
<file>ja_JP.svg</file>
<file>pl.svg</file>
<file>ru.svg</file>
<file>sv.svg</file>
<file>tr_TR.svg</file>
<file>uk.svg</file>
<file>zh_CN.svg</file>
<file>language.svg</file>
<file>language.dark.svg</file>
</qresource>
</RCC>

View File

@ -1 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="1280" height="800" id="Flag of Poland" viewBox="0 0 16 10"><rect width="16" height="10" fill="#fff"/><rect width="16" height="5" fill="#dc143c" y="5"/></svg>

Before

Width:  |  Height:  |  Size: 243 B

View File

@ -1 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 6" width="900" height="600"><rect fill="#fff" width="9" height="3"/><rect fill="#d52b1e" y="3" width="9" height="3"/><rect fill="#0039a6" y="2" width="9" height="2"/></svg>

Before

Width:  |  Height:  |  Size: 265 B

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="1600" height="1000" viewBox="0 0 16 10">
<rect width="16" height="10" fill="#006aa7"/>
<rect width="2" height="10" x="5" fill="#fecc00"/>
<rect width="16" height="2" y="4" fill="#fecc00"/>
</svg>

Before

Width:  |  Height:  |  Size: 281 B

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="800">
<rect width="1200" height="800" fill="#E30A17"/>
<circle cx="425" cy="400" r="200" style="fill:#ffffff"/>
<circle cx="475" cy="400" r="160" style="fill:#E30A17"/>
<polygon style="fill:#ffffff"
points="583.334,400 764.235,458.779 652.431,304.894 652.431,495.106 764.235,341.221"/>
</svg>

Before

Width:  |  Height:  |  Size: 396 B

View File

@ -1,4 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="800">
<rect width="1200" height="800" fill="#005BBB"/>
<rect width="1200" height="400" y="400" fill="#FFD500"/>
</svg>

Before

Width:  |  Height:  |  Size: 179 B

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="1500" height="1000" viewBox="-5 -5 30 20">
<title>Flag of the People's Republic of China</title>
<rect fill="#de2910" x="-5" y="-5" width="30" height="20"/>
<defs>
<polygon id="s" points="0,-513674 301930,415571 -488533,-158734 488533,-158734 -301930,415571"
fill="#ffde00" transform="scale(0.0000019467600073)"/>
</defs>
<use xlink:href="#s" transform="scale(3)"/>
<use xlink:href="#s" transform="translate(5,-3) rotate(-120.963756)"/>
<use xlink:href="#s" transform="translate(7,-1) rotate(-98.130102)"/>
<use xlink:href="#s" transform="translate(7,2) rotate(-74.054604)"/>
<use xlink:href="#s" transform="translate(5,4) rotate(-51.3401917)"/>
</svg>

Before

Width:  |  Height:  |  Size: 895 B

View File

@ -7,7 +7,6 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "main_application.h"
#include "main_window_preferences_frame.h"
#include <ui/qt/utils/qt_ui_utils.h>
@ -16,6 +15,7 @@
#include <epan/prefs-int.h>
#include <ui/qt/models/pref_models.h>
#include <ui/qt/utils/color_utils.h>
#include <wsutil/filesystem.h>
#include "ui/qt/widgets/wireshark_file_dialog.h"
@ -55,6 +55,10 @@ MainWindowPreferencesFrame::MainWindowPreferencesFrame(QWidget *parent) :
ui->maxFilterLineEdit->setMaximumWidth(num_entry_width);
ui->maxRecentLineEdit->setMaximumWidth(num_entry_width);
QString li_path = QString(":/languages/language%1.svg").arg(ColorUtils::themeIsDark() ? ".dark" : "");
QIcon language_icon = QIcon(li_path);
ui->languageComboBox->setItemIcon(0, language_icon);
QString globalLanguagesPath(QString(get_datafile_dir()) + "/languages/");
QString userLanguagesPath(gchar_free_to_qstring(get_persconffile_path("languages/", FALSE)));
@ -69,15 +73,8 @@ MainWindowPreferencesFrame::MainWindowPreferencesFrame(QWidget *parent) :
locale.remove(0, locale.indexOf('_') + 1);
QString lang = QLocale::languageToString(QLocale(locale).language());
QIcon ico = QIcon();
if (QFile::exists(QString(":/languages/%1.svg").arg(locale)))
ico.addFile(QString(":/languages/%1.svg").arg(locale));
if (QFile::exists(globalLanguagesPath + locale + ".svg"))
ico.addFile(globalLanguagesPath + locale + ".svg");
if (QFile::exists(userLanguagesPath + locale + ".svg"))
ico.addFile(userLanguagesPath + locale + ".svg");
ui->languageComboBox->addItem(ico, lang, locale);
ui->languageComboBox->addItem(lang, locale);
}
ui->languageComboBox->setItemData(0, USE_SYSTEM_LANGUAGE);