diff options
-rw-r--r-- | client/aboutbox.cc | 160 | ||||
-rw-r--r-- | client/aboutbox.h | 59 | ||||
-rw-r--r-- | client/client.pro | 4 | ||||
-rw-r--r-- | client/client.qrc | 2 | ||||
-rw-r--r-- | client/expandbutton.cc | 49 | ||||
-rw-r--r-- | client/expandbutton.h | 50 | ||||
-rw-r--r-- | client/icons/icon.png | bin | 19344 -> 21788 bytes | |||
-rw-r--r-- | client/icons/padlock.png | bin | 1221 -> 703 bytes | |||
-rw-r--r-- | client/macrodrawer.cc | 2 | ||||
-rw-r--r-- | client/macrodrawer.h | 4 | ||||
-rw-r--r-- | client/mainwindow.cc | 16 | ||||
-rw-r--r-- | client/mainwindow.h | 3 | ||||
-rw-r--r-- | server/AUTHORS | 11 | ||||
-rw-r--r-- | server/COPYING | 41 |
14 files changed, 372 insertions, 29 deletions
diff --git a/client/aboutbox.cc b/client/aboutbox.cc new file mode 100644 index 0000000..e4d1ffd --- /dev/null +++ b/client/aboutbox.cc @@ -0,0 +1,160 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set et sw=2 ts=2: */ +/*************************************************************************** + * aboutbox.cc + * + * Tue Oct 11 14:39:02 CEST 2011 + * Copyright 2011 Lars Bisballe Jensen + * elsenator@gmail.com + ****************************************************************************/ + +/* + * This file is part of Pracro. + * + * Pracro is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Pracro is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Pracro; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#include "aboutbox.h" +#include "stdio.h" + +#include <QLabel> +#include <QVBoxLayout> +#include <QFile> +#include <QTimer> +#include <QScrollBar> +#include <QScrollArea> + +AboutBox::AboutBox(QWidget *parent, Qt::WindowFlags f): QDialog(parent, f) +{ + setWindowTitle(tr("About Pracro")); + setFixedSize(590,500); + + // Read AUTHORS data from file + QFile file(":AUTHORS"); + QByteArray authorsText; + if(file.open(QIODevice::ReadOnly)) { + authorsText = file.readAll(); + file.close(); + } else { + printf("ERROR: Couldn't find AUTHORS file at the designated location.\n"); + authorsText = "ERROR: File not found..."; + } + + // Read COPYING data from file + file.setFileName(":COPYING"); + QByteArray gplText; + if(file.open(QIODevice::ReadOnly)) { + gplText = file.readAll(); + file.close(); + } else { + printf("ERROR: Couldn't find COPYING file at the designated location.\n"); + gplText = "ERROR: File not found..."; + } + + QVBoxLayout *layout = new QVBoxLayout(); + + QHBoxLayout *topLayout = new QHBoxLayout(); + QLabel *logo = new QLabel(); + logo->setPixmap(QPixmap(":icons/icon.png")); + QLabel *title = new QLabel(tr("<h1>Pracro Client</h1>" + "<h2>v."VERSION"</h2>" + "Developed at Aarhus University Hospital")); + + topLayout->addWidget(logo); + topLayout->addWidget(title); + topLayout->setStretch(1, 1); + topLayout->setStretch(2, 2); + + QLabel *releaseInfo = new QLabel(authorsText); + releaseInfo->setStyleSheet("QLabel { background-color : white; }"); + + QScrollArea *releaseInfoScroll = new QScrollArea(); + releaseInfoScroll->setWidget(releaseInfo); + + QLabel *license = new QLabel(gplText); + license->setStyleSheet("QLabel { font-family: monospace; " + "background-color : white; }"); + licenseScroll = new QScrollArea(); + licenseScroll->setWidget(license); + + connect(licenseScroll->verticalScrollBar(), SIGNAL(sliderPressed()), + this, SLOT(noMoreScroll())); + tabs = new QTabWidget(); + connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(checkTab(int))); + tabs->addTab(releaseInfoScroll, "Release Info"); + tabs->addTab(licenseScroll, "License"); + + layout->addLayout(topLayout); + layout->addWidget(tabs); + setLayout(layout); + + scrollState = 0; // 0 = initial state + // 1 = initiate scroll + // 2 = scroll 1 step + // 3 = no more scroll + + scrollTimer = new QTimer(); + scrollTimer->setSingleShot(true); + connect(scrollTimer, SIGNAL(timeout()), this, SLOT(scroll())); +} + +void AboutBox::mousePressEvent(QMouseEvent * event) +{ + if(event) { // TODO: Perhaps do a mouse click check on the event + accept(); + } +} + +void AboutBox::scroll() +{ + switch(scrollState) { + case 0 : // 0 = initial state + scrollState = 1; + scrollTimer->setInterval(5000); + scrollTimer->start(); + break; + case 1 : // 1 = initiate scroll + scrollState = 2; + licenseScroll->verticalScrollBar()->setValue(0); + scrollTimer->setInterval(200); + scrollTimer->start(); + break; + case 2 : // 2 = scroll 1 step + licenseScroll->verticalScrollBar()-> + setValue(licenseScroll->verticalScrollBar()->value() + 2); + if(licenseScroll->verticalScrollBar()->value() >= + licenseScroll->verticalScrollBar()->maximum()) { + scrollState = 0; + } + scrollTimer->start(); + break; + case 3 : // 3 = no more scroll + scrollTimer->stop(); + break; + } +} + +void AboutBox::noMoreScroll() +{ + scrollState = 3; +} + +void AboutBox::checkTab(int tabIndex) +{ + if(tabIndex == 1) { + scrollState = 0; + scrollTimer->stop(); + scroll(); + } +} diff --git a/client/aboutbox.h b/client/aboutbox.h new file mode 100644 index 0000000..db031f5 --- /dev/null +++ b/client/aboutbox.h @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set et sw=2 ts=2: */ +/*************************************************************************** + * aboutbox.h + * + * Tue Oct 11 14:39:02 CEST 2011 + * Copyright 2011 Lars Bisballe Jensen + * elsenator@gmail.com + ****************************************************************************/ + +/* + * This file is part of Pracro. + * + * Pracro is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Pracro is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Pracro; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#ifndef __PRACRO_ABOUTBOX_H__ +#define __PRACRO_ABOUTBOX_H__ + +#include <QDialog> +#include <QMouseEvent> +#include <QScrollArea> +#include <QTabWidget> + +class AboutBox : public QDialog +{ +Q_OBJECT + +public: + AboutBox(QWidget *parent, Qt::WindowFlags f); + +public slots: + void scroll(); + void noMoreScroll(); + void checkTab(int tabIndex); + +signals: + +private: + void mousePressEvent(QMouseEvent * event); + QScrollArea *licenseScroll; + QTimer *scrollTimer; + int scrollState; + QTabWidget *tabs; +}; + + +#endif/*__PRACRO_ABOUTBOX_H__*/ diff --git a/client/client.pro b/client/client.pro index 97d9d7d..dd926a9 100644 --- a/client/client.pro +++ b/client/client.pro @@ -54,6 +54,8 @@ HEADERS += \ resumewidget.h \ template.h \ widgets.h \ + expandbutton.h \ + aboutbox.h \ widgets/common.h \ widgets/widget.h \ widgets/label.h \ @@ -94,6 +96,8 @@ SOURCES += \ praxisd.cc \ resumewidget.cc \ template.cc \ + expandbutton.cc \ + aboutbox.cc \ widgets/common.cc \ widgets/widget.cc \ widgets/label.cc \ diff --git a/client/client.qrc b/client/client.qrc index d85a872..696a869 100644 --- a/client/client.qrc +++ b/client/client.qrc @@ -14,5 +14,7 @@ <file>icons/icon_close_no_commit.png</file> <file>icons/icon_discard.png</file> <file>fonts/VeraMono.ttf</file> + <file alias="COPYING">../server/COPYING</file> + <file alias="AUTHORS">../server/AUTHORS</file> </qresource> </RCC> diff --git a/client/expandbutton.cc b/client/expandbutton.cc new file mode 100644 index 0000000..13e44bf --- /dev/null +++ b/client/expandbutton.cc @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set et sw=2 ts=2: */ +/*************************************************************************** + * expandbutton.cc + * + * Mon Oct 10 10:19:14 CEST 2011 + * Copyright 2011 Lars Bisballe Jensen + * elsenator@gmail.com + ****************************************************************************/ + +/* + * This file is part of Pracro. + * + * Pracro is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Pracro is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Pracro; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#include "expandbutton.h" +#include <stdio.h> + +ExpandButton::ExpandButton(QWidget * parent) + : QPushButton(parent) +{ + +} + +void ExpandButton::focusInEvent(QFocusEvent * event) +{ + if (event) { + } + setStyleSheet("background-color: blue"); +} + +void ExpandButton::focusOutEvent(QFocusEvent * event) +{ + if (event) { + } + setStyleSheet("background-color:"); +} diff --git a/client/expandbutton.h b/client/expandbutton.h new file mode 100644 index 0000000..85d0ce4 --- /dev/null +++ b/client/expandbutton.h @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set et sw=2 ts=2: */ +/*************************************************************************** + * expandbutton.h + * + * Mon Oct 10 10:19:14 CEST 2011 + * Copyright 2011 Lars Bisballe Jensen + * elsenator@gmail.com + ****************************************************************************/ + +/* + * This file is part of Pracro. + * + * Pracro is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Pracro is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Pracro; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#ifndef __PRACRO_EXPANDBUTTON_H__ +#define __PRACRO_EXPANDBUTTON_H__ + +#include <QPushButton> +#include <QFocusEvent> + +class ExpandButton : public QPushButton +{ +Q_OBJECT + +public: + ExpandButton(QWidget * parent = 0); + +public slots: + +signals: + +private: + void focusInEvent(QFocusEvent * event); + void focusOutEvent(QFocusEvent * event); +}; + +#endif/*__PRACRO_EXPANDBUTTON_H__*/ diff --git a/client/icons/icon.png b/client/icons/icon.png Binary files differindex 7be2e6f..7fe7f30 100644 --- a/client/icons/icon.png +++ b/client/icons/icon.png diff --git a/client/icons/padlock.png b/client/icons/padlock.png Binary files differindex 6e626df..4658186 100644 --- a/client/icons/padlock.png +++ b/client/icons/padlock.png diff --git a/client/macrodrawer.cc b/client/macrodrawer.cc index 570ce54..10dbea0 100644 --- a/client/macrodrawer.cc +++ b/client/macrodrawer.cc @@ -60,7 +60,7 @@ MacroDrawer::MacroDrawer(Macro *macro, QString title) } if(!macro->isstatic) { - button = new QPushButton(this); + button = new ExpandButton(this); button->setFixedSize(16,16); button->move(0,0); { diff --git a/client/macrodrawer.h b/client/macrodrawer.h index 9cebebc..256d550 100644 --- a/client/macrodrawer.h +++ b/client/macrodrawer.h @@ -27,6 +27,8 @@ #ifndef __PRACRO_MACRODRAWER_H__ #define __PRACRO_MACRODRAWER_H__ +#include "expandbutton.h" + #include <QGroupBox> #include <QString> #include <QPushButton> @@ -49,7 +51,7 @@ signals: private: QWidget *edge; - QPushButton *button; + ExpandButton *button; }; #endif/*__PRACRO_MACRODRAWER_H__*/ diff --git a/client/mainwindow.cc b/client/mainwindow.cc index 6bf0543..7db7076 100644 --- a/client/mainwindow.cc +++ b/client/mainwindow.cc @@ -41,6 +41,7 @@ #include <QEvent> #include <QCloseEvent> +#include "aboutbox.h" #include "messagebox.h" #include "macrodrawer.h" @@ -102,7 +103,14 @@ MainWindow::MainWindow(QString patientid, QString course, QString templ, setWindowIcon(QIcon(":/icons/icon.png")); QStatusBar *status = statusBar(); - status->addPermanentWidget(new QLabel("Pracro v."VERSION)); + //status->addPermanentWidget(new QLabel("Pracro v."VERSION)); + + aboutButton = new QPushButton("Pracro v."VERSION, status); + aboutButton->setIcon(QIcon(":icons/icon.png")); + connect(aboutButton, SIGNAL(clicked()), this, SLOT(showAbout())); + + status->addPermanentWidget(aboutButton); + if(dbg_enabled()) { status->addPermanentWidget(new Dbg()); } @@ -133,6 +141,12 @@ MainWindow::~MainWindow() { } +void MainWindow::showAbout() +{ + AboutBox aboutBox(this, Qt::Dialog); + aboutBox.exec(); +} + bool MainWindow::hasOpen(void *me) { Entities::iterator i = entities.begin(); diff --git a/client/mainwindow.h b/client/mainwindow.h index c52db58..4a06724 100644 --- a/client/mainwindow.h +++ b/client/mainwindow.h @@ -50,6 +50,7 @@ public: public slots: // void update(); + void showAbout(); void closeCommit(); void closeNoCommit(); void closeDiscard(); @@ -79,6 +80,8 @@ private: QLabel *header; + QPushButton *aboutButton; + bool initialising; // Sessions sessions; diff --git a/server/AUTHORS b/server/AUTHORS index d3d20c2..e692324 100644 --- a/server/AUTHORS +++ b/server/AUTHORS @@ -1,8 +1,9 @@ -Main developer: +Main Developer: Bent Bisballe Nyeng (deva@aasimon.org) -Base64 code: - Peter Skaarup (piparum@piparum.dk) +Pracro Server (pracrod): + Bent Bisballe Nyeng (deva@aasimon.org) -Qt Client: - Lars Bisballe Jensen (elsenator@gmail.com)
\ No newline at end of file +Pracro Client: + Bent Bisballe Nyeng (deva@aasimon.org) + Lars Bisballe Jensen (elsenator@gmail.com) diff --git a/server/COPYING b/server/COPYING index 623b625..d159169 100644 --- a/server/COPYING +++ b/server/COPYING @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - - GNU GENERAL PUBLIC LICENSE + + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions: License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names: This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. |