mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-19 12:53:25 +01:00
Add a 'language_without_region' as this is not specific to networkremotesettingpage
This commit is contained in:
parent
9bf5690671
commit
fc1880161c
@ -157,6 +157,14 @@ void Application::AddError(const QString& message) {
|
||||
emit ErrorAdded(message);
|
||||
}
|
||||
|
||||
QString Application::language_without_region() const {
|
||||
const int underscore = language_name_.indexOf('_');
|
||||
if (underscore != -1) {
|
||||
return language_name_.left(underscore);
|
||||
}
|
||||
return language_name_;
|
||||
}
|
||||
|
||||
LibraryBackend* Application::library_backend() const {
|
||||
return library()->backend();
|
||||
}
|
||||
|
@ -55,7 +55,9 @@ public:
|
||||
Application(QObject* parent = NULL);
|
||||
~Application();
|
||||
|
||||
QString language_name() const { return language_name_; }
|
||||
const QString& language_name() const { return language_name_; }
|
||||
// Same as language_name, but remove the region code at the end if there is one
|
||||
QString language_without_region() const;
|
||||
void set_language_name(const QString& name) { language_name_ = name; }
|
||||
|
||||
TagReaderClient* tag_reader_client() const { return tag_reader_client_; }
|
||||
|
@ -89,11 +89,7 @@ void NetworkRemoteSettingsPage::Load() {
|
||||
ui_->ip_address->setText(ip_addresses);
|
||||
|
||||
// Get the right play store badge for this language.
|
||||
QString language = dialog()->app()->language_name();
|
||||
const int underscore = language.indexOf('_');
|
||||
if (underscore != -1) {
|
||||
language = language.left(underscore);
|
||||
}
|
||||
QString language = dialog()->app()->language_without_region();
|
||||
|
||||
QString badge_filename = ":/playstore/" + language + "_generic_rgb_wo_45.png";
|
||||
if (!QFile::exists(badge_filename)) {
|
||||
|
Loading…
Reference in New Issue
Block a user