00001 /********************************************************************
00002 Description: main widget of client-configuration-frontend (Qt)
00003 part of the 3Dsia project
00004 created: StonedBones, 28.2.2000
00005
00006 History:
00007 date, name, changes, in funtion
00008 280200 StonedBones created source
00009
00010 ********************************************************************/
00011
00012 #include "mainWidget.h"
00013
00014 #include <stdio.h>
00015
00016 /*...................................................................
00017 Description: the main widget (constructor)
00018 Args: char* name: window title
00019 Returns: <none>
00020 Created: StonedBones, 28.2.2000
00021 [ToDo:]
00022 [Comments:]
00023 Changes:
00024 -------------------------------------------------------------------*/
00025
00026 MyMainWidget::MyMainWidget (const char *name) : QWidget (NULL, name) {
00027 setFixedSize ( 400, 300 );
00028
00029 fileMenu = new QPopupMenu (NULL, "File operations");
00030 CHECK_PTR (fileMenu);
00031 fileMenu->insertItem ("Exit", this, SLOT (quitProg()));
00032
00033 menuBar = new QMenuBar (this);
00034 CHECK_PTR (menuBar);
00035 menuBar->insertItem ("File", fileMenu);
00036
00037 QLabel* tmpLabel;
00038 tmpLabel = new QLabel (this);
00039 CHECK_PTR (tmpLabel);
00040 tmpLabel->setText ("Default input device");
00041 tmpLabel->setGeometry (5, 30, 150, 50);
00042 tmpLabel->setFrameStyle (QFrame::WinPanel | QFrame::Sunken);
00043 tmpLabel->setAlignment (AlignHCenter | AlignTop);
00044
00045 Joy = new JoystickWidget (this);
00046 CHECK_PTR (Joy);
00047 Joy->setGeometry (160, 30, 235, 200);
00048 Joy->setFrameStyle (QFrame::WinPanel | QFrame::Sunken);
00049 Joy->hide ();
00050
00051 chooseDevice = new QComboBox (tmpLabel);
00052 CHECK_PTR (chooseDevice);
00053 chooseDevice->insertItem ("<none>");
00054 chooseDevice->insertItem ("Joystick");
00055 chooseDevice->setGeometry (2, 23, 146, 25);
00056 chooseDevice->setStyle (WindowsStyle);
00057
00058 connect (chooseDevice, SIGNAL (activated (const char*)), this, SLOT (showJoystick (const char*)));
00059 };
00060
00061 /*...................................................................
00062 Description: quits the GUI
00063 Args: <none>
00064 Returns: <none>
00065 Created: StonedBones, 28.2.2000
00066 [ToDo:]
00067 - quits the whole client at the moments, needs to be fixed
00068 [Comments:]
00069 Changes:
00070 -------------------------------------------------------------------*/
00071
00072 void MyMainWidget::quitProg () {
00073 printf ("Configuration complete, please run again\n");
00074 exit ( 0 );
00075 };
00076
00077 void MyMainWidget::showJoystick (const char* str) {
00078 if (strcmp (str, "Joystick") == 0) {
00079 Joy->show ();
00080 } else {
00081 Joy->hide ();
00082 };
00083 };