[Libreoffice-commits] core.git: cui/source cui/uiconfig

Tor Lillqvist tml at collabora.com
Fri Nov 28 03:37:21 PST 2014


 cui/source/options/optopencl.cxx               |   36 ++++++++++++++++++++-----
 cui/uiconfig/ui/blackorwhitelistentrydialog.ui |   31 +++++++++++++++++++--
 2 files changed, 58 insertions(+), 9 deletions(-)

New commits:
commit 791a8780a7dcbb062c7553eec81e3c1887ecdade
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Nov 28 13:32:40 2014 +0200

    Make the OS choice a combobox
    
    Change-Id: Ie10d8f01b847f868e2a8d5afae8b313de3a98d91

diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx
index 1de17b8..2c3e94e 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 12feaa3..5306d7a 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>


More information about the Libreoffice-commits mailing list