summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/pracro.cc6
-rw-r--r--client/pracro.ini3
-rw-r--r--client/widgets/combobox.cc38
-rw-r--r--client/widgets/combobox.h2
-rw-r--r--client/widgets/widget.cc2
5 files changed, 40 insertions, 11 deletions
diff --git a/client/pracro.cc b/client/pracro.cc
index e33ebfc..e47ff1d 100644
--- a/client/pracro.cc
+++ b/client/pracro.cc
@@ -31,6 +31,8 @@
#include <QStringList>
#include <QSettings>
+#include <QTranslator>
+
#include "netcom.h"
#include "mainwindow.h"
@@ -142,6 +144,10 @@ int main(int argc, char *argv[])
port = settings.value("port").toInt();
settings.endGroup();
+ QTranslator translator;
+ translator.load("pracro_dk");
+ app.installTranslator(&translator);
+
MainWindow mainwindow(cpr, course, host, port, user);
mainwindow.show();
diff --git a/client/pracro.ini b/client/pracro.ini
index 8192ea5..25fd0bf 100644
--- a/client/pracro.ini
+++ b/client/pracro.ini
@@ -1,3 +1,4 @@
[server]
-host=127.0.0.1
+#host=pracserv.j.auh.dk
+host=localhost
port=12345
diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc
index 2818db3..c4a7f13 100644
--- a/client/widgets/combobox.cc
+++ b/client/widgets/combobox.cc
@@ -33,11 +33,24 @@
#include "common.h"
+// Enable this to make the combobox drawn in windows style.
+// This will make its background red even when not expanded.
+//#define STYLE_HACK
+
+#ifdef STYLE_HACK
+#include <QWindowsStyle>
+QWindowsStyle s;
+#endif/*STYLE_HACK*/
+
ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow)
: QComboBox(), Widget(node, macrowindow)
{
setCommonAttributes(this, node);
+#ifdef STYLE_HACK
+ setStyle(&s);
+#endif/*STYLE_HACK*/
+
setInsertPolicy(QComboBox::InsertAlphabetically);
QDomNodeList children = node.childNodes();
@@ -70,6 +83,12 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow)
case SELECT:
setEditable(false);
+#ifndef STYLE_HACK
+ setEditable(true);
+ lineEdit()->setReadOnly(true);
+ lineEdit()->installEventFilter(this);
+#endif/*STYLE_HACK*/
+
connect(this, SIGNAL(currentIndexChanged(QString)), this, SLOT(changed()));
break;
@@ -190,14 +209,6 @@ void ComboBox::connectTo(const QObject *sender, const char *signal,
connect(sender, signal, this, method);
}
-/*
-bool ComboBox::eventFilter(QObject *, QEvent *event)
-{
- if (event->type() == QEvent::KeyPress) emit wasChanged();
- return false;
-}
-*/
-
bool ComboBox::setKeyboardFocus()
{
setFocus();
@@ -208,3 +219,14 @@ void ComboBox::setVisibility(bool visible)
{
setVisible(visible);
}
+
+bool ComboBox::eventFilter(QObject *obj, QEvent *event)
+{
+ if(combotype == SELECT) {
+ if(event->type() == QEvent::MouseButtonRelease) {
+ showPopup();
+ }
+ }
+
+ return QObject::eventFilter(obj, event);
+}
diff --git a/client/widgets/combobox.h b/client/widgets/combobox.h
index 922d51d..af48ba5 100644
--- a/client/widgets/combobox.h
+++ b/client/widgets/combobox.h
@@ -69,7 +69,7 @@ signals:
void wasChanged();
protected:
- // bool eventFilter(QObject *, QEvent *event);
+ bool eventFilter(QObject *obj, QEvent *event);
private:
QRegExp rx;
diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc
index 870fc4b..42db8f6 100644
--- a/client/widgets/widget.cc
+++ b/client/widgets/widget.cc
@@ -79,7 +79,7 @@ bool Widget::regexpValidator()
}
bool Widget::luaValidator()
-{
+{
if(!hasluaprogram) return true;
if(macrowindow->luaprograms.contains(luaprogram) == false) return false;