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/source/options | |
parent | 94bcfb04194baa55f995de57981a293cbd1a4f5e (diff) |
Make the OS choice a combobox
Change-Id: Ie10d8f01b847f868e2a8d5afae8b313de3a98d91
Diffstat (limited to 'cui/source/options')
-rw-r--r-- | cui/source/options/optopencl.cxx | 36 |
1 files changed, 30 insertions, 6 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(); |