diff options
| author | deva <deva> | 2009-01-13 09:59:22 +0000 | 
|---|---|---|
| committer | deva <deva> | 2009-01-13 09:59:22 +0000 | 
| commit | 9fcf15a06b9ec422dbad53508e8ce71d2d4145c3 (patch) | |
| tree | d54147e52b1939ba9ebaf356e7047dfebea02887 /client/mainwindow.cc | |
| parent | 9d982a5b4fc9c7efaa56c8f7a4130361f26b0302 (diff) | |
A huge amount of changes, based on the results of two usertest.
The changes are contained (but not limited to) in the following list:
 - Make disabled widgets ignored in validation test.
 - Do not commit values of disabled widgets to the database.
 - Make storechildren attribute on metawidget, that enables storing of the child widgets in the database.
 - Implement LUA resume generator.
 - Make language attribute on resume tag, and switch parser (format/LUA).
 - Case insensitive search in combobox.
 - Click on macro name or line, expands macro.
 - Greyed out widgets in AltComboBox should be hidden instead.
 - Keyboard 'delete' should delete item from multilist.
 - "Commit" button needs to be more visible? Icon?
 - Upon opening of a second macro, the first macro should indicate itself as 'not saved'.
 - After 'add' in multilist, the input widgets should be reset.
 - First widget in a macro should have keyboard focus after expansion.
 - "Endnu ikke udfyldt" needs to be more clear (darker).
 - Meta widgets must recurse the isValid() call to its children.
 - Greyed out widgets must be hidden.
 - Multilist should be read as a list prior to its input fields.
 - Visible field on widgets. Hides a widget without disabling it.
Diffstat (limited to 'client/mainwindow.cc')
| -rw-r--r-- | client/mainwindow.cc | 81 | 
1 files changed, 53 insertions, 28 deletions
| diff --git a/client/mainwindow.cc b/client/mainwindow.cc index 86de48a..639c9d0 100644 --- a/client/mainwindow.cc +++ b/client/mainwindow.cc @@ -34,15 +34,20 @@  #include <QHBoxLayout>  #include <QLabel>  #include <QPushButton> -#include <QGroupBox>  #include <QScrollArea> +#include <QSettings> +#include <QStatusBar> + +#include "macrodrawer.h"  MainWindow::MainWindow(QString cpr, QString course, QString host, quint16 port, QString user) -  : netcom(host, port, user, cpr) +  : QMainWindow(0, Qt::WindowContextHelpButtonHint), +    netcom(host, port, user, cpr)  { -  resize(768, 1024); +  setWindowTitle("Pracro - " + cpr); -  setWindowFlags(windowFlags() | Qt::WindowContextHelpButtonHint ); +  QStatusBar *status = statusBar(); +  status->addPermanentWidget(new QLabel("Pracro v.1.0.0 - test2"));    QScrollArea *s = new QScrollArea();    setCentralWidget(s); @@ -54,14 +59,33 @@ MainWindow::MainWindow(QString cpr, QString course, QString host, quint16 port,    this->course = course;    init(); + +  status->showMessage("Makroen blev succesfuldt indlęst.");  }  MainWindow::~MainWindow()  {  } +void MainWindow::closeEvent(QCloseEvent *) +{ +  QSettings settings("Aasimon.org", "Pracro"); + +  settings.beginGroup("MainWindow"); +  settings.setValue("size", size()); +  settings.setValue("pos", pos()); +  settings.endGroup(); +} +  void MainWindow::init()  { +  QSettings settings("Aasimon.org", "Pracro"); + +  settings.beginGroup("MainWindow"); +  resize(settings.value("size", QSize(700, 800)).toSize()); +  move(settings.value("pos", QPoint(0, 0)).toPoint()); +  settings.endGroup(); +    initialising = true;    update();    initialising = false; @@ -108,31 +132,10 @@ void MainWindow::update()          if(xml_elem.attribute("static", "false") == "true") isstatic = true;          if(xml_elem.attribute("compact", "false") == "true") iscompact = true;          macros[macroname] = new MacroWindow(&netcom, macronode, course, !isstatic, iscompact); +        macros[macroname]->isstatic = isstatic; -        QGroupBox *g = new QGroupBox(); -        g->setTitle("      " + xml_elem.attribute("caption", macroname)); -        g->setFlat(true); -        { -          QFont f = g->font(); -          //f.setBold(true); -          f.setItalic(true); -          g->setFont(f); -        } +        MacroDrawer *g = new MacroDrawer(macros[macroname], xml_elem.attribute("caption", macroname));          ((QBoxLayout*)w->layout())->addWidget(g); - -        if(!isstatic) { -          QPushButton *b = new QPushButton("±", g); -          b->setFixedSize(16,16); -          b->move(0,0); -          { -            QFont f = b->font(); -            f.setBold(false); -            f.setItalic(false); -            b->setFont(f); -          } - -          connect(b, SIGNAL(clicked()), macros[macroname], SLOT(toggleMacro())); -        }          QHBoxLayout *l = new QHBoxLayout();          l->setContentsMargins(10,0,10,0); @@ -145,6 +148,7 @@ void MainWindow::update()            f.setItalic(false);            macros[macroname]->setFont(f);          } +        } else {          macros[macroname]->update(macronode); @@ -155,5 +159,26 @@ void MainWindow::update()        }      }    } -} +  // Make sure that all macros will collapse when a new one is expanded. +  QMap< QString, MacroWindow* >::iterator i = macros.begin(); +  while(i != macros.end()) { +    MacroWindow *m1 = i.value(); + +    QMap< QString, MacroWindow* >::iterator j = macros.begin(); +    while(j != macros.end()) { +      MacroWindow *m2 = j.value(); + +      if(m1 != m2 && m2->isstatic == false) { +        // Remove old connection (if any), to avoid multiple connections. +        disconnect(m1, SIGNAL(expanding()), m2, SLOT(collapseWrapper())); + +        connect(m1, SIGNAL(expanding()), m2, SLOT(collapseWrapper())); +      } + +      j++; +    } + +    i++; +  } +} | 
