diff options
author | David Boddie <david.boddie@nokia.com> | 2011-05-11 17:35:46 +0200 |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2011-05-23 14:24:07 +0200 |
commit | 0cbcc61ef35b9bce1d65d048853c79004b755b87 (patch) | |
tree | 0e10f00827d9d3b84862e371d163f1b2774ee996 /examples/widgets/maemovibration/main.cpp | |
parent | 0748751c9f097d9d866605306bbdd4b96e2a5c4e (diff) |
Squashed commit of changes from the 4.8-temp branch.
Diffstat (limited to 'examples/widgets/maemovibration/main.cpp')
-rw-r--r-- | examples/widgets/maemovibration/main.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/examples/widgets/maemovibration/main.cpp b/examples/widgets/maemovibration/main.cpp new file mode 100644 index 0000000000..f81529b185 --- /dev/null +++ b/examples/widgets/maemovibration/main.cpp @@ -0,0 +1,44 @@ + +#include "buttonwidget.h" +#include "mcevibrator.h" + +#include <QtDebug> +#include <QApplication> +#include <QFile> +#include <QTextStream> +#include <QMessageBox> +#include <QTextStream> + +#include <cstdlib> + +//! [0] +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QString path = MceVibrator::defaultMceFilePath; + + QFile file(path); + QStringList names; + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream stream(&file); + names = MceVibrator::parsePatternNames(stream); + file.close(); + } + + if (names.isEmpty()){ + qDebug() << "Could not read vibration pattern names from " << path; + a.exit(-1); + } +//! [0] + +//! [1] + ButtonWidget buttonWidget(names); + MceVibrator vibrator; + QObject::connect(&buttonWidget, SIGNAL(clicked(const QString &)), + &vibrator, SLOT(vibrate(const QString &))); + buttonWidget.show(); + + return a.exec(); +} +//! [1] + |