Commits

mrudolf committed ad2ceb4

Enable most settings. Show doesn't work yet.

Comments (0)

Files changed (6)

 		qDebug() << "Settings" << reply->url();
 		if (redirection.isValid())
 			m_lastSettings = m_network->get(request("settings", redirection));
+		qDebug() << reply->readAll();
 	}
 	else if (reply == m_lastQuery) {
 		if (redirection.isValid())

src/poliqarpsettingsdialog.cpp

 	QDialog(parent)
 {
 	ui.setupUi(this);
+	connect(ui.randomSampleCheck, SIGNAL(toggled(bool)), ui.randomSampleSpin,
+			  SLOT(setEnabled(bool)));
 }
 
 void PoliqarpSettingsDialog::restoreSettings(const QString &server)
 	ui.leftWidthSpin->setValue(settings.value("left_context_width", 5).toInt());
 	ui.rightWidthSpin->setValue(settings.value("right_context_width", 5).toInt());
 	ui.contextWidthSpin->setValue(settings.value("wide_context_width", 50).toInt());
+	settings.endGroup();
 }
 
 void PoliqarpSettingsDialog::saveSettings()
 	settings.beginGroup(m_serverUrl);
 
 	settings.setValue("random_sample", ui.randomSampleCheck->isChecked());
-	settings.value("random_sample_size", ui.randomSampleSpin->value());
+	settings.setValue("random_sample_size", ui.randomSampleSpin->value());
 
-	settings.value("sort", ui.sortGroup->isChecked());
+	settings.setValue("sort", ui.sortGroup->isChecked());
 	QString column;
 	if (ui.leftMatchSortRadio->isChecked())
 		column = "lm";
 	// Fixed
 	settings.setValue("graphical_concordances", 0);
 	settings.setValue("results_per_page", 25);
+	settings.endGroup();
 }

src/poliqarpsettingsdialog.ui

      </item>
      <item>
       <widget class="QSpinBox" name="randomSampleSpin">
+       <property name="enabled">
+        <bool>false</bool>
+       </property>
        <property name="minimum">
         <number>1</number>
        </property>

src/poliqarpwidget.cpp

 
 #include "poliqarpwidget.h"
 #include "poliqarp.h"
+#include "poliqarpsettingsdialog.h"
 #include "messagedialog.h"
 #include "djvuitemlist.h"
 
 
 	 connect(ui.serverCombo, SIGNAL(currentIndexChanged(int)), this,
 				SLOT(connectToServer()));
+	 connect(ui.configureServerButton, SIGNAL(clicked()), this, SLOT(configureServer()));
 	 connect(ui.searchButton, SIGNAL(clicked()), this, SLOT(doSearch()));
 	 connect(ui.corpusCombo, SIGNAL(currentIndexChanged(int)), this,
 				  SLOT(doSelectSource()));
 		ui.serverCombo->setCurrentIndex(0);
 }
 
+void PoliqarpWidget::configureServer()
+{
+	PoliqarpSettingsDialog dlg(this);
+	dlg.restoreSettings(ui.serverCombo->currentText());
+	if (dlg.exec()) {
+		dlg.saveSettings();
+		m_poliqarp->updateSettings();
+	}
+}
+
 void PoliqarpWidget::adjustTextColumns()
 {
 	 // Resize columns

src/poliqarpwidget.h

 	 void clear();
 	 void configure();
 private slots:
+	 void configureServer();
 	 void doSelectSource();
 	 void doSearch();
 	 void connected(const QStringList& sources);

src/poliqarpwidget.ui

    <rect>
     <x>0</x>
     <y>0</y>
-    <width>616</width>
+    <width>490</width>
     <height>442</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string notr="true">Form</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout">
-   <item row="0" column="0">
-    <widget class="QLabel" name="serverLabel">
-     <property name="text">
-      <string>&amp;Server:</string>
-     </property>
-     <property name="buddy">
-      <cstring>serverCombo</cstring>
-     </property>
-    </widget>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QGridLayout" name="gridLayout">
+     <item row="0" column="0">
+      <widget class="QLabel" name="serverLabel">
+       <property name="text">
+        <string>&amp;Server:</string>
+       </property>
+       <property name="buddy">
+        <cstring>serverCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="1">
+      <layout class="QHBoxLayout" name="horizontalLayout_4">
+       <item>
+        <widget class="QComboBox" name="serverCombo">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QToolButton" name="configureServerButton">
+         <property name="text">
+          <string>...</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item row="1" column="0">
+      <widget class="QLabel" name="corpusLabel">
+       <property name="text">
+        <string>Co&amp;rpus:</string>
+       </property>
+       <property name="buddy">
+        <cstring>corpusCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="1">
+      <widget class="QComboBox" name="corpusCombo">
+       <property name="enabled">
+        <bool>false</bool>
+       </property>
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="0">
+      <widget class="QLabel" name="queryLabel">
+       <property name="text">
+        <string>&amp;Query:</string>
+       </property>
+       <property name="buddy">
+        <cstring>queryCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="1">
+      <layout class="QHBoxLayout" name="horizontalLayout_5">
+       <item>
+        <widget class="QComboBox" name="queryCombo">
+         <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>
+       <item>
+        <widget class="QPushButton" name="searchButton">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
+         <property name="text">
+          <string>&amp;Search</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
    </item>
-   <item row="1" column="0">
-    <widget class="QLabel" name="corpusLabel">
-     <property name="text">
-      <string>Co&amp;rpus:</string>
-     </property>
-     <property name="buddy">
-      <cstring>corpusCombo</cstring>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="1" colspan="3">
-    <widget class="QComboBox" name="corpusCombo">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="0">
-    <widget class="QLabel" name="queryLabel">
-     <property name="text">
-      <string>&amp;Query:</string>
-     </property>
-     <property name="buddy">
-      <cstring>queryCombo</cstring>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="1" colspan="2">
-    <widget class="QComboBox" name="queryCombo">
-     <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>
-   <item row="2" column="3">
-    <widget class="QPushButton" name="searchButton">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
-     <property name="text">
-      <string>&amp;Search</string>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="0" colspan="4">
+   <item>
     <widget class="QTabWidget" name="resultWidget">
      <property name="tabPosition">
       <enum>QTabWidget::South</enum>
      </widget>
     </widget>
    </item>
-   <item row="4" column="3">
-    <widget class="QPushButton" name="moreButton">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
-     <property name="text">
-      <string>&amp;More...</string>
-     </property>
-    </widget>
-   </item>
-   <item row="4" column="0" colspan="3">
-    <widget class="QLabel" name="matchLabel">
-     <property name="text">
-      <string/>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="1" colspan="3">
-    <widget class="QComboBox" name="serverCombo">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-    </widget>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_6">
+     <item>
+      <widget class="QLabel" name="matchLabel">
+       <property name="text">
+        <string/>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="moreButton">
+       <property name="enabled">
+        <bool>false</bool>
+       </property>
+       <property name="text">
+        <string>&amp;More...</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
    </item>
   </layout>
  </widget>
  </customwidgets>
  <tabstops>
   <tabstop>serverCombo</tabstop>
+  <tabstop>configureServerButton</tabstop>
   <tabstop>corpusCombo</tabstop>
   <tabstop>queryCombo</tabstop>
   <tabstop>searchButton</tabstop>
+  <tabstop>resultWidget</tabstop>
+  <tabstop>textResultTable</tabstop>
+  <tabstop>moreButton</tabstop>
+  <tabstop>metadataBrowser</tabstop>
  </tabstops>
  <resources/>
  <connections/>