From ee5b3e99fcff0573ea39a2ed52027ef6a60f6b01 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 27 Feb 2009 10:00:28 +0000 Subject: Fixed multiple adding of the header (on each update) --- client/mainwindow.cc | 22 +++++++++++++--------- client/mainwindow.h | 2 ++ 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'client') diff --git a/client/mainwindow.cc b/client/mainwindow.cc index 884ecf2..6ba72e0 100644 --- a/client/mainwindow.cc +++ b/client/mainwindow.cc @@ -44,6 +44,8 @@ MainWindow::MainWindow(QString cpr, QString course, QString host, quint16 port, : QMainWindow(0, Qt::WindowContextHelpButtonHint), netcom(host, port, user, cpr) { + header = NULL; + setWindowTitle("Pracro - " + cpr); QStatusBar *status = statusBar(); @@ -103,15 +105,17 @@ void MainWindow::update() QString course_title = course_elem.attribute("title"); QString course_name = course_elem.attribute("name"); - QLabel *header = new QLabel(); - header->setText(course_title); - QFont headerfont = header->font(); - headerfont.setBold(true); - headerfont.setPointSize(headerfont.pointSize() + 4); - header->setFont(headerfont); - header->setAlignment(Qt::AlignHCenter); - w->layout()->addWidget(header); - + if(!header) { + header = new QLabel(); + header->setText(course_title); + QFont headerfont = header->font(); + headerfont.setBold(true); + headerfont.setPointSize(headerfont.pointSize() + 4); + header->setFont(headerfont); + header->setAlignment(Qt::AlignHCenter); + w->layout()->addWidget(header); + } + statusBar()->showMessage(course_title + " (" + course_name + ")"); QDomNodeList macronodes = coursenode.childNodes(); diff --git a/client/mainwindow.h b/client/mainwindow.h index f23ade1..00300f4 100644 --- a/client/mainwindow.h +++ b/client/mainwindow.h @@ -51,6 +51,8 @@ private: QMap< QString, MacroWindow* > macros; QWidget *w; + QLabel *header; + bool initialising; void init(); -- cgit v1.2.3