From cc3e4ba1e4c93ab2198453e04039e57387a79e60 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 29 Nov 2011 12:19:19 +0100 Subject: remove old debug code. --- client/widgets/window.cc | 7 ------- 1 file changed, 7 deletions(-) (limited to 'client') diff --git a/client/widgets/window.cc b/client/widgets/window.cc index a305171..b491d44 100644 --- a/client/widgets/window.cc +++ b/client/widgets/window.cc @@ -30,14 +30,9 @@ #include #include -//#define DEBUG(fmt...) printf(fmt) -#define DEBUG(ftm...) - Window::Window(QDomNode &node, MacroWindow *macrowindow) : Widget(node, macrowindow) { - DEBUG("window\n"); - widget = new QWidget(NULL); widget->setWindowFlags(Qt::WindowContextHelpButtonHint | @@ -65,8 +60,6 @@ Window::Window(QDomNode &node, MacroWindow *macrowindow) Window::~Window() { - DEBUG("~window\n"); - //delete widget; } -- cgit v1.2.3 From 4c2626ad56b871cf3b12cdfa786e632b3f29a71e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 30 Nov 2011 09:43:09 +0100 Subject: Make sure we don't 'bounce' around when animating to the same height. --- client/collapser.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'client') diff --git a/client/collapser.cc b/client/collapser.cc index 599397f..a802396 100644 --- a/client/collapser.cc +++ b/client/collapser.cc @@ -110,8 +110,14 @@ void Collapser::anim() placeholder.setWeight(x); - int height = (int)((1 - y) * placeholder.fromHeight() + - y * placeholder.toHeight()); + // Make sure we don't 'bounce' around when animating to the same height. + int height; + if(placeholder.fromHeight() == placeholder.toHeight()) { + height = placeholder.fromHeight(); + } else { + height = (int)((1 - y) * placeholder.fromHeight() + + y * placeholder.toHeight()); + } setFixedHeight(height); -- cgit v1.2.3 From 29c58328af0d9ec8fa77253451e8d4801b372db3 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 30 Nov 2011 10:54:29 +0100 Subject: Since from to to heights are the same this is a noop, but it seems more correct this way. --- client/collapser.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'client') diff --git a/client/collapser.cc b/client/collapser.cc index a802396..2057a0e 100644 --- a/client/collapser.cc +++ b/client/collapser.cc @@ -32,8 +32,8 @@ #include "debug.h" -#define ANIM_TIME 300 // ms -#define ANIM_INTERVAL 5 // ms +#define ANIM_TIME 100 // ms +#define ANIM_INTERVAL 50 // ms Collapser::Collapser(QWidget *current, QScrollArea *scroll) { @@ -113,7 +113,7 @@ void Collapser::anim() // Make sure we don't 'bounce' around when animating to the same height. int height; if(placeholder.fromHeight() == placeholder.toHeight()) { - height = placeholder.fromHeight(); + height = placeholder.toHeight(); } else { height = (int)((1 - y) * placeholder.fromHeight() + y * placeholder.toHeight()); -- cgit v1.2.3 From 094a66765fcb111ede1c1fbd1b540183ff4c130f Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 30 Nov 2011 10:56:29 +0100 Subject: Make sure the drawer button is focused before the macro is deleted. Otherwise something random will gain focus making the scroll area jump to this random position. --- client/macrowindow.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'client') diff --git a/client/macrowindow.cc b/client/macrowindow.cc index 44f2797..2e0f52a 100644 --- a/client/macrowindow.cc +++ b/client/macrowindow.cc @@ -189,11 +189,13 @@ bool MacroWindow::doCommit() void MacroWindow::commit() { doCommit(); + drawer->setFocus(); } void MacroWindow::cancel() { collapseWrapper(); + drawer->setFocus(); } void MacroWindow::expandWrapper() @@ -271,9 +273,9 @@ void MacroWindow::clear() lua->clear(); if(mainwidget) { - delete mainwidget; - mainwidget = NULL; drawer->setFocus(); + mainwidget->deleteLater(); + mainwidget = NULL; } } -- cgit v1.2.3 From 5d5595b9e1c1c22f7033a262b8174a5f3d05adc8 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 1 Dec 2011 09:11:17 +0100 Subject: Reorganise TabOrder according to child nesting order. --- client/macrowindow.cc | 33 +++++++++++++++++++++++++++++++++ client/macrowindow.h | 1 + 2 files changed, 34 insertions(+) (limited to 'client') diff --git a/client/macrowindow.cc b/client/macrowindow.cc index 2e0f52a..48ace4e 100644 --- a/client/macrowindow.cc +++ b/client/macrowindow.cc @@ -52,6 +52,7 @@ MacroWindow::MacroWindow(NetCom &n, QString course, QString templ, MacroDrawer *d) : Collapser(NULL, is_static?NULL:scrollarea), netcom(n) { + this->scrollarea = scrollarea; drawer = d; this->is_static = is_static; @@ -279,6 +280,36 @@ void MacroWindow::clear() } } +QWidgetList getRecursiveWidgetList(QWidget *w) +{ + QWidgetList list; + + list.append(w); + + QObjectList objs = w->children(); + for(int i = 0; i < objs.size(); i++) { + if(objs[i]->isWidgetType()) { + QWidget *cw = (QWidget*)objs[i]; + list.append(getRecursiveWidgetList(cw)); + } + } + + return list; +} + +void setTabOrderRecursive(QWidget *w) +{ + QWidgetList list = getRecursiveWidgetList(w); + QWidget *last = NULL; + for(int i = 0; i < list.size(); i++) { + QWidget *w = list[i]; + if((w->focusPolicy() & Qt::TabFocus) != 0) { + if(last) QWidget::setTabOrder(last, w); + last = w; + } + } +} + void MacroWindow::animated(QWidget *w) { if(w == resumewidget) { @@ -294,6 +325,8 @@ void MacroWindow::animated(QWidget *w) if(is_static) return; + setTabOrderRecursive(scrollarea); + // Set keyboard focus on the first focusable widget in the macro. mainwidget->setKeyboardFocus(); } diff --git a/client/macrowindow.h b/client/macrowindow.h index afc144d..65a0d87 100644 --- a/client/macrowindow.h +++ b/client/macrowindow.h @@ -94,6 +94,7 @@ private: bool is_static; MacroDrawer *drawer; + QWidget *scrollarea; }; #endif/*__PRACRO_MACROWINDOW_H__*/ -- cgit v1.2.3 From 45336cbecb6eff3317a365f271dc548c297f4ffa Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 1 Dec 2011 09:33:12 +0100 Subject: Fix setKeyboardFocus to work recursive on all widgets. Fixes bug where MultiList did not receive keyboard focus when it is the first child in the macro window. --- client/macrowindow.cc | 2 +- client/widgets/widget.cc | 34 +++++++++++++++++++++++++++------- client/widgets/widget.h | 1 + client/widgets/window.cc | 9 --------- 4 files changed, 29 insertions(+), 17 deletions(-) (limited to 'client') diff --git a/client/macrowindow.cc b/client/macrowindow.cc index 48ace4e..f924d8c 100644 --- a/client/macrowindow.cc +++ b/client/macrowindow.cc @@ -328,6 +328,6 @@ void MacroWindow::animated(QWidget *w) setTabOrderRecursive(scrollarea); // Set keyboard focus on the first focusable widget in the macro. - mainwidget->setKeyboardFocus(); + mainwidget->setKeyboardFocusRecursive(); } } diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc index ac90ef2..a57eb78 100644 --- a/client/widgets/widget.cc +++ b/client/widgets/widget.cc @@ -313,8 +313,26 @@ bool Widget::hidden() bool Widget::setKeyboardFocus() { - widget->setFocus(); - return true; + if((widget->focusPolicy() & Qt::TabFocus) != 0) { + widget->setFocus(); + return true; + } + + return false; +} + +bool Widget::setKeyboardFocusRecursive() +{ + if(setKeyboardFocus()) return true; + + QVector< Widget* >::iterator i = children.begin(); + while(i != children.end()) { + Widget *w = *i; + if(w && w->setKeyboardFocusRecursive()) return true; + i++; + } + + return false; } Widget *Widget::findWidget(QString n, bool deep) @@ -514,11 +532,13 @@ void Widget::createWidget(QDomNode &xml_node, QLayout *layout) } - addChild(widget); - - if(layout) layout->addWidget(widget->qwidget()); - - if(widget && widget->qwidget()) widget->qwidget()->show(); + if(widget) { + addChild(widget); + if(widget->qwidget()) { + if(layout) layout->addWidget(widget->qwidget()); + widget->qwidget()->show(); + } + } } int wdg_name(lua_State *L) diff --git a/client/widgets/widget.h b/client/widgets/widget.h index 4f23790..6199aa4 100644 --- a/client/widgets/widget.h +++ b/client/widgets/widget.h @@ -111,6 +111,7 @@ public: virtual bool hidden(); virtual bool setKeyboardFocus(); + bool setKeyboardFocusRecursive(); virtual void setForegroundColour(unsigned char red, unsigned char green, diff --git a/client/widgets/window.cc b/client/widgets/window.cc index b491d44..7aa6374 100644 --- a/client/widgets/window.cc +++ b/client/widgets/window.cc @@ -65,14 +65,5 @@ Window::~Window() bool Window::setKeyboardFocus() { - QVector< Widget* >::iterator i = children.begin(); - while(i != children.end()) { - Widget *w = *i; - if(w) { - if(w->setKeyboardFocus()) return true; - } - i++; - } - return false; } -- cgit v1.2.3 From 728e74df239bac0f61faea062bb5a45340ee6d24 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 1 Dec 2011 10:40:27 +0100 Subject: Force focus on combobox in altcombobox in order to avoid the inner widget gaining focus even though it is hidden. --- client/widgets/altcombobox.cc | 6 ++++++ client/widgets/altcombobox.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'client') diff --git a/client/widgets/altcombobox.cc b/client/widgets/altcombobox.cc index 9956fff..082601a 100644 --- a/client/widgets/altcombobox.cc +++ b/client/widgets/altcombobox.cc @@ -107,6 +107,12 @@ AltComboBox::~AltComboBox() { } +bool AltComboBox::setKeyboardFocus() +{ + combobox->setFocus(); + return true; +} + QComboBox *AltComboBox::qcombobox() { return combobox; diff --git a/client/widgets/altcombobox.h b/client/widgets/altcombobox.h index e6a21d7..b0fb61c 100644 --- a/client/widgets/altcombobox.h +++ b/client/widgets/altcombobox.h @@ -94,6 +94,8 @@ public: QComboBox *qcombobox(); + bool setKeyboardFocus(); + public slots: void comboChanged(); void onChildChange(); -- cgit v1.2.3 From 8dbc6ee0fbc1dd4485ec0ff1cf4a48e24b0b41a8 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 1 Dec 2011 11:26:49 +0100 Subject: Make combobox selection list popup on spacebar or mousedown. --- client/widgets/combobox.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'client') diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc index eed2d10..935f620 100644 --- a/client/widgets/combobox.cc +++ b/client/widgets/combobox.cc @@ -93,6 +93,8 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow) // Make empty default selection. combobox->setCurrentIndex(-1); + combobox->installEventFilter(this); + QDomElement elem = node.toElement(); combotype = SELECT; @@ -213,15 +215,26 @@ void ComboBox::changed() emit eventOnChange(); } +#include bool ComboBox::eventFilter(QObject *obj, QEvent *event) { if(ignoreChangeEvents == true) return false; + if(combotype == SELECT) { if(event->type() == QEvent::MouseButtonRelease) { if(enabled()) combobox->showPopup(); } } + if(event->type() == QEvent::KeyPress) { + QKeyEvent *ke = (QKeyEvent*)event; + // printf("KEY: %d\n", ke->key()); + // if(ke->key() == Qt::Key_Up || ke->key() == Qt::Key_Down) { + if(ke->key() == Qt::Key_Space) { + if(enabled()) combobox->showPopup(); + } + } + return QObject::eventFilter(obj, event); } -- cgit v1.2.3 From ef111490bf0fef23f338910c0a54c142aa61d938 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 1 Dec 2011 11:27:07 +0100 Subject: Set window title and icon. --- client/pcpviewer/pcpviewer.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'client') diff --git a/client/pcpviewer/pcpviewer.cc b/client/pcpviewer/pcpviewer.cc index 5853e0a..ea59edb 100644 --- a/client/pcpviewer/pcpviewer.cc +++ b/client/pcpviewer/pcpviewer.cc @@ -42,6 +42,9 @@ PCPViewer::PCPViewer(QString patientid) : praxisd("sarge", 10000) { + setWindowTitle(tr("Pracro Patient View")); + setWindowIcon(QIcon(":/icons/icon.png")); + this->patientid = patientid; setLayout(new QVBoxLayout()); -- cgit v1.2.3 From e0107f150cefec8a8f90c5c7ebfd13e875c02e85 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 1 Dec 2011 14:06:35 +0100 Subject: Restore sane animationtime value. --- client/collapser.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client') diff --git a/client/collapser.cc b/client/collapser.cc index 2057a0e..abbe295 100644 --- a/client/collapser.cc +++ b/client/collapser.cc @@ -32,7 +32,7 @@ #include "debug.h" -#define ANIM_TIME 100 // ms +#define ANIM_TIME 200 // ms #define ANIM_INTERVAL 50 // ms Collapser::Collapser(QWidget *current, QScrollArea *scroll) -- cgit v1.2.3 From 1dc78c2b5875697a926776befc33cb7161bc6eb1 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 1 Dec 2011 14:22:09 +0100 Subject: Make sure space is added in the bottom (stretch) if the window is taller than the macros. --- client/mainwindow.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'client') diff --git a/client/mainwindow.cc b/client/mainwindow.cc index 121412e..4cb721f 100644 --- a/client/mainwindow.cc +++ b/client/mainwindow.cc @@ -337,6 +337,9 @@ void MainWindow::updateMacros(QDomNodeList &nodes) break; } } + + QVBoxLayout *l = (QVBoxLayout*)central->layout(); + l->addStretch(1); } } -- cgit v1.2.3 From 5ed7a801b4194e72cc3898de57fb1d9ea0e8caa4 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 1 Dec 2011 14:53:08 +0100 Subject: Added missing strings. --- client/pracro_dk.ts | 83 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 62 insertions(+), 21 deletions(-) (limited to 'client') diff --git a/client/pracro_dk.ts b/client/pracro_dk.ts index 9c7fd40..72cda12 100644 --- a/client/pracro_dk.ts +++ b/client/pracro_dk.ts @@ -1,6 +1,19 @@ + + AboutBox + + + About Pracro + Om Pracro + + + + <h1>Pracro Client</h1><h2>v. + <h1>Pracro Klient</h1><h2>v. + + DBWidget @@ -53,43 +66,43 @@ et CPR nummer på 10 cifre. MacroWindow - + Error Der er sket en fejl - + The macro Makroen - + was not filled out correctly, please try again. er ikke.udfyldt korrekt. Prøv igen. - + Save the macro changes? Gem makro ændringer? - + you have choosen to close the macro Du har valgt at lukke makroen - + do you want to save before closing? ønsker du at gemme dine ændringer først? - + Close first Luk først - + Close other one first. Luk den åbne makro først. @@ -97,26 +110,26 @@ et CPR nummer på 10 cifre. MainWindow - + Close and commit Gem i journal - + Close no commit Gem som kladde - - - + + + Close first. Luk først. - - - + + + Close open macros first. Luk åbne makroer først. @@ -133,14 +146,14 @@ et CPR nummer på 10 cifre. Denne session bliver husket på denne specifikke maskine. For at genåbne på et senere tidspunkt, skal du blot genåbne på samme patient. - - + + Discard Kassér - - + + This session will <strong>NOT</strong> be stored in the journal.<br/>Are you sure you want to continue? Dette vil slette alle indtastede data. Denne session vil <strong>IKKE</strong> blive gemt i journalen hvis du fortsætter. Fortsætter du kan dataene <strong>IKKE</strong> gendannes.<br/>Er du sikker på du vil fortsætte? @@ -158,6 +171,26 @@ et CPR nummer på 10 cifre. Remove form list Fjern fra listen + + + Inner widget changed. + Indre widget er ændret. + + + + The inner widget changed, and you didn't add it to the list. +Do you want to continue and discard the change? + Den indre widget har ændret sig men er ikke tilføjet til listen. +Vil du fortsætte og smide ændringerne væk? + + + + PCPViewer + + + Pracro Patient View + Pracro Patient Visning + QObject @@ -252,9 +285,17 @@ et CPR nummer på 10 cifre. Ignorér - + Depends on: Afhænger af: + + Template + + + Open + Åbn + + -- cgit v1.2.3