diff options
author | Tor Lillqvist <tml@collabora.com> | 2014-11-28 13:32:40 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2014-11-28 13:32:52 +0200 |
commit | 791a8780a7dcbb062c7553eec81e3c1887ecdade (patch) | |
tree | 07c3754f80c0aec0f1c28dd6dec5b4cf15d7b4b7 /cui | |
parent | 94bcfb04194baa55f995de57981a293cbd1a4f5e (diff) |
Make the OS choice a combobox
Change-Id: Ie10d8f01b847f868e2a8d5afae8b313de3a98d91
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/optopencl.cxx | 36 | ||||
-rw-r--r-- | cui/uiconfig/ui/blackorwhitelistentrydialog.ui | 31 |
2 files changed, 58 insertions, 9 deletions
diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx index 1de17b8248b1..2c3e94ede87a 100644 --- a/cui/source/options/optopencl.cxx +++ b/cui/source/options/optopencl.cxx @@ -140,12 +140,13 @@ class ListEntryDialog : public ModalDialog public: OpenCLConfig::ImplMatcher maEntry; - Edit* mpOS; + ListBox* mpOS; Edit* mpOSVersion; Edit* mpPlatformVendor; Edit* mpDevice; Edit* mpDriverVersion; + DECL_LINK(OSSelectHdl, ListBox*); DECL_LINK(EditModifiedHdl, Edit*); ListEntryDialog(vcl::Window* pParent, const OpenCLConfig::ImplMatcher& rEntry, const OString& rTag); @@ -162,13 +163,25 @@ ListEntryDialog::ListEntryDialog(vcl::Window* pParent, const OpenCLConfig::ImplM get(mpDevice, "device"); get(mpDriverVersion, "driverversion"); - mpOS->SetText(rEntry.maOS); + // Hardcode knowledge that entry 0 is the "Any" + if (maEntry.maOS == "") + { + mpOS->SelectEntryPos(0, false); + } + else + { + for (int i = 0; i < mpOS->GetEntryCount(); ++i) + { + if (maEntry.maOS == mpOS->GetEntry(i)) + mpOS->SelectEntryPos(i, false); + } + } mpOSVersion->SetText(rEntry.maOSVersion); mpPlatformVendor->SetText(rEntry.maPlatformVendor); mpDevice->SetText(rEntry.maDevice); mpDriverVersion->SetText(rEntry.maDriverVersion); - mpOS->SetModifyHdl(LINK(this, ListEntryDialog, EditModifiedHdl)); + mpOS->SetSelectHdl(LINK( this, ListEntryDialog, OSSelectHdl)); mpOSVersion->SetModifyHdl(LINK(this, ListEntryDialog, EditModifiedHdl)); mpPlatformVendor->SetModifyHdl(LINK(this, ListEntryDialog, EditModifiedHdl)); mpDevice->SetModifyHdl(LINK(this, ListEntryDialog, EditModifiedHdl)); @@ -177,11 +190,22 @@ ListEntryDialog::ListEntryDialog(vcl::Window* pParent, const OpenCLConfig::ImplM SetText(get<FixedText>(rTag + "title")->GetText()); } +IMPL_LINK(ListEntryDialog, OSSelectHdl, ListBox*, pListBox) +{ + if (pListBox == mpOS) + { + if (mpOS->GetSelectEntryPos() == 0) + maEntry.maOS = ""; + else + maEntry.maOS = mpOS->GetEntry(mpOS->GetSelectEntryPos()); + } + + return 0; +} + IMPL_LINK(ListEntryDialog, EditModifiedHdl, Edit*, pEdit) { - if (pEdit == mpOS) - maEntry.maOS = pEdit->GetText(); - else if (pEdit == mpOSVersion) + if (pEdit == mpOSVersion) maEntry.maOSVersion = pEdit->GetText(); else if (pEdit == mpPlatformVendor) maEntry.maPlatformVendor = pEdit->GetText(); diff --git a/cui/uiconfig/ui/blackorwhitelistentrydialog.ui b/cui/uiconfig/ui/blackorwhitelistentrydialog.ui index 12feaa339ea7..5306d7ab2cea 100644 --- a/cui/uiconfig/ui/blackorwhitelistentrydialog.ui +++ b/cui/uiconfig/ui/blackorwhitelistentrydialog.ui @@ -2,7 +2,32 @@ <!-- Generated with glade 3.18.3 --> <interface> <requires lib="gtk+" version="3.0"/> - <requires lib="LibreOffice" version="1.0"/> + <object class="GtkListStore" id="os-liststore"> + <columns> + <!-- column-name value --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gint"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">Any</col> + <col id="1">0</col> + </row> + <row> + <col id="0" translatable="no">Linux</col> + <col id="1">1</col> + </row> + <row> + <col id="0" translatable="no">OS X</col> + <col id="1">2</col> + </row> + <row> + <col id="0" translatable="no">Windows</col> + <col id="1">3</col> + </row> + </data> + </object> <object class="GtkDialog" id="BlackOrWhiteListEntryDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> @@ -98,11 +123,11 @@ </packing> </child> <child> - <object class="GtkEntry" id="os"> + <object class="GtkComboBox" id="os"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="width_chars">12</property> + <property name="model">os-liststore</property> </object> <packing> <property name="left_attach">0</property> |