From 6ec8b32ba119eb04d43979363f6b5c6134e1ea32 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sun, 26 Dec 2010 11:10:45 +0100
Subject: Tweaked user search UI a bit.


diff --git a/Swift/QtUI/UserSearch/QtUserSearchFirstPage.ui b/Swift/QtUI/UserSearch/QtUserSearchFirstPage.ui
index cbf3831..3139f66 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchFirstPage.ui
+++ b/Swift/QtUI/UserSearch/QtUserSearchFirstPage.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>300</height>
+    <width>422</width>
+    <height>315</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -21,13 +21,6 @@
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
-    <widget class="QLabel" name="errorLabel_">
-     <property name="text">
-      <string>&lt;font color='red'&gt;errorLabel_&lt;/font&gt;</string>
-     </property>
-    </widget>
-   </item>
-   <item>
     <widget class="QLabel" name="howLabel_">
      <property name="text">
       <string>howLabel_</string>
@@ -35,11 +28,18 @@
     </widget>
    </item>
    <item>
-    <widget class="QRadioButton" name="byJID_">
-     <property name="text">
-      <string>I know their JID</string>
-     </property>
-    </widget>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <widget class="QRadioButton" name="byJID_">
+       <property name="text">
+        <string>I know their JID:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="jid_"/>
+     </item>
+    </layout>
    </item>
    <item>
     <widget class="QRadioButton" name="byLocalSearch_">
@@ -49,26 +49,49 @@
     </widget>
    </item>
    <item>
-    <widget class="QRadioButton" name="byRemoteSearch_">
-     <property name="text">
-      <string>I'd like to search another server</string>
-     </property>
-    </widget>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QRadioButton" name="byRemoteSearch_">
+       <property name="text">
+        <string>I'd like to search another server:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QComboBox" name="service_">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="editable">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
    </item>
    <item>
-    <widget class="QLabel" name="jidLabel_">
-     <property name="text">
-      <string>jidLabel_</string>
+    <spacer name="verticalSpacer_2">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
      </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QLineEdit" name="jid_"/>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>77</height>
+      </size>
+     </property>
+    </spacer>
    </item>
    <item>
-    <widget class="QComboBox" name="service_">
-     <property name="editable">
-      <bool>true</bool>
+    <widget class="QLabel" name="errorLabel_">
+     <property name="text">
+      <string>&lt;font color='red'&gt;errorLabel_&lt;/font&gt;</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignCenter</set>
      </property>
     </widget>
    </item>
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
index 82479be..034b59c 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
@@ -35,6 +35,7 @@ QtUserSearchWindow::QtUserSearchWindow(UIEventStream* eventStream, UserSearchWin
 #if QT_VERSION >= 0x040700
 		firstPage_->jid_->setPlaceholderText("alice@wonderland.lit");
 #endif
+	firstPage_->service_->setEnabled(false);
 	fieldsPage_ = new QtUserSearchFieldsPage();
 	fieldsPage_->fetchingThrobber_->setMovie(new QMovie(":/icons/throbber.gif", QByteArray(), this));
 	fieldsPage_->fetchingThrobber_->movie()->stop();
@@ -106,24 +107,19 @@ int QtUserSearchWindow::nextId() const {
 
 void QtUserSearchWindow::handleFirstPageRadioChange() {
 	if (firstPage_->byJID_->isChecked()) {
-		firstPage_->jidLabel_->setText("What is their JID?");
-		firstPage_->jidLabel_->show();
-		firstPage_->service_->hide();
 		firstPage_->jid_->setText("");
-		firstPage_->jid_->show();
+		firstPage_->jid_->setEnabled(true);
+		firstPage_->service_->setEnabled(false);
 		restart();
 	} else if (firstPage_->byRemoteSearch_->isChecked()) {
-		firstPage_->jidLabel_->setText("Which server do you want to search? (This has the form 'wonderland.lit')");
-		firstPage_->jidLabel_->hide();
-		firstPage_->service_->show();
 		firstPage_->service_->setEditText("");
+		firstPage_->jid_->setEnabled(false);
+		firstPage_->service_->setEnabled(true);
 		//firstPage_->jid_->setText("");
-		firstPage_->jid_->hide();
 		restart();
 	} else {
-		firstPage_->jid_->hide();
-		firstPage_->jidLabel_->hide();
-		firstPage_->service_->hide();
+		firstPage_->jid_->setEnabled(false);
+		firstPage_->service_->setEnabled(false);
 		restart();
 	}
 }
-- 
cgit v0.10.2-6-g49f6