From 791a8780a7dcbb062c7553eec81e3c1887ecdade Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 28 Nov 2014 13:32:40 +0200 Subject: Make the OS choice a combobox Change-Id: Ie10d8f01b847f868e2a8d5afae8b313de3a98d91 --- cui/source/options/optopencl.cxx | 36 +++++++++++++++++++++----- 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(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 @@ - + + + + + + + + + + Any + 0 + + + Linux + 1 + + + OS X + 2 + + + Windows + 3 + + + False 6 @@ -98,11 +123,11 @@ - + True True True - 12 + os-liststore 0 -- cgit