diff options
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 0000000..f81529b --- /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] + |