Show descriptions for disabled file dialog options

This commit is contained in:
Eric Kotato 2021-03-31 23:24:33 +03:00
parent 35008195e8
commit e26085b627
9 changed files with 35 additions and 10 deletions

View file

@ -2756,6 +2756,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ktg_settings_file_dialog_type" = "File dialog";
"ktg_file_dialog_type_default" = "Default";
"ktg_file_dialog_disabled_on_build" = "Disabled on build";
"ktg_file_dialog_disabled_by_option" = "Disabled by option";
"ktg_settings_other" = "Other";
"ktg_profile_copy_id" = "Copy ID";

View file

@ -70,6 +70,8 @@
"ktg_settings_gtk_integration": "GTK integration",
"ktg_settings_file_dialog_type": "File dialog",
"ktg_file_dialog_type_default": "Default",
"ktg_file_dialog_disabled_on_build": "Disabled on build",
"ktg_file_dialog_disabled_by_option": "Disabled by option",
"ktg_settings_other": "Other",
"ktg_profile_copy_id": "Copy ID",
"ktg_profile_bot_id": "Bot ID",

View file

@ -69,6 +69,8 @@
"ktg_settings_gtk_integration": "GTK-интеграция",
"ktg_settings_file_dialog_type": "Файловый диалог",
"ktg_file_dialog_type_default": "По умолчанию",
"ktg_file_dialog_disabled_on_build": "Отключено при сборке",
"ktg_file_dialog_disabled_by_option": "Отключено настройкой",
"ktg_settings_other": "Прочие",
"ktg_profile_copy_id": "Копировать ID",
"ktg_profile_bot_id": "ID бота",

View file

@ -477,6 +477,7 @@ void SetupKotatoSystem(
int(cFileDialogType()),
int(Platform::FileDialog::ImplementationType::Count),
FileDialogTypeLabel,
Platform::FileDialog::ImplementationTypeDescription,
[=](int value) {
cSetFileDialogType(Platform::FileDialog::ImplementationType(value));
::Kotato::JsonSettings::Write();

View file

@ -161,17 +161,30 @@ bool GetQt(
QString ImplementationTypeLabel(ImplementationType value) {
switch (value) {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
case ImplementationType::XDP: return qsl("XDG Desktop Portal");
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef DESKTOP_APP_DISABLE_GTK_INTEGRATION
case ImplementationType::GTK: return qsl("GTK");
#endif // !DESKTOP_APP_DISABLE_GTK_INTEGRATION
case ImplementationType::Qt: return qsl("Qt");
}
Unexpected("Value in Platform::FileDialog::ImplementationTypeLabel.");
}
QString ImplementationTypeDescription(ImplementationType value) {
switch (value) {
#ifdef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
case ImplementationType::XDP: return tr::ktg_file_dialog_disabled_on_build(tr::now);
#endif // DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifdef DESKTOP_APP_DISABLE_GTK_INTEGRATION
case ImplementationType::GTK: return tr::ktg_file_dialog_disabled_on_build(tr::now);
#else // DESKTOP_APP_DISABLE_GTK_INTEGRATION
case ImplementationType::GTK:
return GtkIntegration::Instance()
? tr::ktg_file_dialog_disabled_by_option(tr::now)
: QString();
#endif // !DESKTOP_APP_DISABLE_GTK_INTEGRATION
}
return QString();
}
bool Get(
QPointer<QWidget> parent,
QStringList &files,

View file

@ -29,12 +29,8 @@ namespace FileDialog {
enum class ImplementationType {
Default,
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
XDP,
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef DESKTOP_APP_DISABLE_GTK_INTEGRATION
GTK,
#endif // !DESKTOP_APP_DISABLE_GTK_INTEGRATION
Qt,
Count,
};

View file

@ -33,7 +33,11 @@ enum class ImplementationType {
};
inline QString ImplementationTypeLabel(ImplementationType value) {
Unexpected("Value in Platform::FileDialog::TypeLabel.");
Unexpected("Value in Platform::FileDialog::ImplementationTypeLabel.");
}
inline QString ImplementationTypeDescription(ImplementationType value) {
return QString();
}
inline void InitLastPath() {

View file

@ -30,6 +30,7 @@ namespace FileDialog {
enum class ImplementationType;
QString ImplementationTypeLabel(ImplementationType value);
QString ImplementationTypeDescription(ImplementationType value);
void InitLastPath();

View file

@ -30,7 +30,11 @@ enum class ImplementationType {
};
inline QString ImplementationTypeLabel(ImplementationType value) {
Unexpected("Value in Platform::FileDialog::TypeLabel.");
Unexpected("Value in Platform::FileDialog::ImplementationTypeLabel.");
}
inline QString ImplementationTypeDescription(ImplementationType value) {
return QString();
}
} // namespace FileDialog