123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- /*
- @class: MainWindow
- @description: MainWindow is ThinkContacts' main class. MainWindow sets the graphical
- user interface, uses ThinkGearStreamParser to parse the byte sequence sent by the headset
- using the algorithm provided by the headset’s company, uses Bluetooth Manager to achieve
- connection with the headset, loads the contacts’ information from the phone’s address book,
- uses PictureFlow to build the animated image, shows the widget that displays the contacts’
- names and pictures, and implements algorithms to control the flow of images on
- PictureFlow and to make a phone call when required.
- @author: Mirko Perkusich
- Taciana Rached
- */
- /*
- Copyright (c) 2010 Embedded Systems and Pervasive Laboratory, Federal
- University of Campina Grande, Brazil, Angelo Perkusich, Mirko Perkusich,
- Taciana Rached
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
- #ifndef MAINWINDOW_H
- #define MAINWINDOW_H
- #include <QObject>
- #include <QMainWindow>
- #include <QWidget>
- #include <QVBoxLayout>
- #include <QHBoxLayout>
- #include <QLabel>
- #include <QProgressBar>
- #include <QMainWindow>
- #include <QPushButton>
- #include <QSpacerItem>
- #include <QDebug>
- #include <QContact>
- #include <QContactPhoneNumber>
- #include <QContactThumbnail>
- #include <QContactManager>
- #include <QProcess>
- #include "bluetoothmanager.h"
- #include "pictureflow.h"
- #include "ThinkGearStreamParser.h"
- using namespace QtMobility;
- class MainWindow : public QMainWindow
- {
- Q_OBJECT
- public:
- /**
- * Constructor
- */
- explicit MainWindow(QWidget *parent = 0);
- public slots:
- /**
- * Classifies data read by the BluetoothManager through ThinkGearStreamParser
- * @param data QByteArray read by BluetoothManager.
- */
- void classifyData(QByteArray data);
- /**
- * Sets meditation's progress bar and calculates if the application should
- * make a call or not based on inMedLevel.
- * @param inMedLevel is the meditation level calculated by ThinkGearStreamParser.
- */
- void meditationReceived(int inMedLevel);
- /**
- * Sets attention's progress bar and calculates if the application should
- * make a call or not based on inALevel.
- * @param inALevel is the attention level calculated by ThinkGearStreamParser.
- */
- void attentionReceived(int inALevel);
- /**
- * Sets the graphical user interface after bluetooth connection with the headset
- * is established.
- */
- void setWindow();
- /**
- * Makes a phone call to the contact currently located at the center of the screen.
- */
- void makeCall();
- /**
- * Loads information from the phone's addressbook contacts to PictureFlow widget.
- */
- void loadContactsInfo();
- private:
- /** Bluetooth connection manager. */
- BluetoothManager btManager;
- /** Stream parser. */
- ThinkGearStreamParser parser;
- /** Animated image widget. */
- PictureFlow *pFlow;
- /** List with all the contacts on the phone's addressbook. */
- QList<QContact> contacts;
- /** Progress bars for meditation and attention. */
- QProgressBar *medProgBar, *aProgBar;
- /** Connect and Quit buttons. */
- QPushButton *connectButton, *quitButton;
- /**
- *Sets the initial graphical user interface.
- */
- void setMainWindow();
- /**
- * Sets up the connections between the objects
- */
- void setupConnections();
- };
- #endif // MAINWINDOW_H
|