From 09007720225215aed316b6a939fcfd47ee2f5ca9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 24 Dec 2012 14:39:37 +0300 Subject: Replace sliders to dropdowns in misc setup page. --- src/gui/setup_other.cpp | 52 +++++++++++++++++++++++++++++++++---------------- src/gui/setup_other.h | 5 +++-- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp index 24b1837f9..b59cf8041 100644 --- a/src/gui/setup_other.cpp +++ b/src/gui/setup_other.cpp @@ -23,6 +23,7 @@ #include "gui/setup_other.h" #include "gui/widgets/layouthelper.h" +#include "gui/widgets/namesmodel.h" #include "gui/widgets/scrollarea.h" #include "configuration.h" @@ -31,10 +32,36 @@ #include "debug.h" +static const int shortcutsListSize = 3; + +static const char *const shortcutsList[] = +{ + N_("Always show"), + N_("Auto hide in small resolution"), + N_("Always auto hide") +}; + +static const int proxyTypeListSize = 8; + +static const char *const proxyTypeList[] = +{ + // TRANSLATORS: Proxy type selection + N_("System proxy"), + // TRANSLATORS: Proxy type selection + N_("Direct connection"), + "HTTP", + "HTTP 1.0", + "SOCKS4", + "SOCKS4A", + "SOCKS5", + // TRANSLATORS: Proxy type selection + N_("SOCKS5 hostname") +}; + Setup_Other::Setup_Other(const Widget2 *const widget) : SetupTabScroll(widget), - mProxyTypeList(new SetupItemNames), - mShortcutsList(new SetupItemNames) + mProxyTypeList(new NamesModel), + mShortcutsList(new NamesModel) { setName(_("Misc")); @@ -187,25 +214,16 @@ Setup_Other::Setup_Other(const Widget2 *const widget) : new SetupItemLabel(_("Windows"), "", this); - mShortcutsList->push_back(_("Always show")); - mShortcutsList->push_back(_("Auto hide in small resolution")); - mShortcutsList->push_back(_("Always auto hide")); - new SetupItemSlider2(_("Shortcut buttons"), "", "autohideButtons", this, - "autohideButtonsEvent", 0, 2, mShortcutsList, false, true, true); + mShortcutsList->fillFromArray(&shortcutsList[0], shortcutsListSize); + new SetupItemDropDown(_("Shortcut buttons"), "", "autohideButtons", this, + "autohideButtonsEvent", mShortcutsList, 200); new SetupItemLabel(_("Proxy server"), "", this); - mProxyTypeList->push_back(_("System proxy")); - mProxyTypeList->push_back(_("Direct connection")); - mProxyTypeList->push_back("HTTP"); - mProxyTypeList->push_back("HTTP 1.0"); - mProxyTypeList->push_back("SOCKS4"); - mProxyTypeList->push_back("SOCKS4A"); - mProxyTypeList->push_back("SOCKS5"); - mProxyTypeList->push_back(_("SOCKS5 hostname")); - new SetupItemSlider2(_("Proxy type"), "", "downloadProxyType", this, - "downloadProxyTypeEvent", 0, 7, mProxyTypeList); + mProxyTypeList->fillFromArray(&proxyTypeList[0], proxyTypeListSize); + new SetupItemDropDown(_("Proxy type"), "", "downloadProxyType", this, + "downloadProxyTypeEvent", mProxyTypeList, 200); new SetupItemTextField(_("Proxy address:port"), "", "downloadProxy", this, "downloadProxyEvent"); diff --git a/src/gui/setup_other.h b/src/gui/setup_other.h index 37e79e974..29c228823 100644 --- a/src/gui/setup_other.h +++ b/src/gui/setup_other.h @@ -28,6 +28,7 @@ #include class EditDialog; +class NamesModel; class TextField; class Setup_Other final : public SetupTabScroll @@ -42,9 +43,9 @@ class Setup_Other final : public SetupTabScroll void apply(); protected: - SetupItemNames *mProxyTypeList; + NamesModel *mProxyTypeList; - SetupItemNames *mShortcutsList; + NamesModel *mShortcutsList; }; #endif -- cgit v1.2.3-70-g09d2