summaryrefslogtreecommitdiff
path: root/examples
Side-by-side diff
Diffstat (limited to 'examples') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/opiecore/onotifydemo/onotifydemo.cpp30
-rw-r--r--examples/opiecore/onotifydemo/onotifydemo.h29
-rw-r--r--examples/opiecore/onotifydemo/onotifydemo.pro2
3 files changed, 39 insertions, 22 deletions
diff --git a/examples/opiecore/onotifydemo/onotifydemo.cpp b/examples/opiecore/onotifydemo/onotifydemo.cpp
index b9ff9db..a38ffee 100644
--- a/examples/opiecore/onotifydemo/onotifydemo.cpp
+++ b/examples/opiecore/onotifydemo/onotifydemo.cpp
@@ -1,35 +1,33 @@
+#include "onotifydemo.h"
+
/* OPIE */
#include <opie2/odebug.h>
#include <opie2/oapplication.h>
#include <opie2/ofiledialog.h>
#include <opie2/olistview.h>
#include <opie2/ofilenotify.h>
using namespace Opie::Core;
using namespace Opie::Ui;
/* QT */
#include <qcheckbox.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qhbuttongroup.h>
#include <qvbuttongroup.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
-class DemoApp : public OApplication
-{
- Q_OBJECT
-public:
- DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 notify demo" )
+DemoApp::DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 notify demo" )
{
QVBox* vbox = new QVBox();
setMainWidget( vbox );
l = new OListView( vbox );
l->addColumn( "Notification Path" );
l->addColumn( "Trigger Type" );
l->addColumn( "Trigger Mask" );
l->setColumnAlignment( 1, AlignCenter );
l->setColumnAlignment( 2, AlignCenter );
@@ -61,26 +59,25 @@ public:
connect( plus1, SIGNAL( clicked() ), this, SLOT( addSingle() ) );
connect( plus2, SIGNAL( clicked() ), this, SLOT( addMulti() ) );
connect( minus, SIGNAL( clicked() ), this, SLOT( delTrigger() ) );
g1->show();
g2->show();
l->show();
hbox->show();
vbox->show();
showMainWidget( vbox );
}
-public:
- void addTrigger( bool multi = false )
+ void DemoApp::addTrigger( bool multi )
{
if ( !m )
{
QMessageBox::warning( 0, "Add Trigger", "<p>Can't add trigger without at least one selected trigger type</p>", "&Sorry", 0 );
return;
}
QString filename = OFileDialog::getOpenFileName( OFileSelector::ExtendedAll );
if ( !filename.isEmpty() )
{
odebug << "Filename = " << filename << oendl;
@@ -91,54 +88,45 @@ public:
new OListViewItem( l, filename, multi ? "MULTI" : "SINGLE", modifier );
if ( !multi )
OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype );
else
OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype );
}
else
{
odebug << "cancelled." << oendl;
}
}
-public slots:
- void modifierClicked( int modifier ) { m = static_cast<OFileNotificationType>( (int)m ^ int(modifier) ); };
- void addSingle() { addTrigger(); };
- void addMulti() { addTrigger( true ); };
+ void DemoApp::modifierClicked( int modifier ) { m = static_cast<OFileNotificationType>( (int)m ^ int(modifier) ); };
+ void DemoApp::addSingle() { addTrigger(); };
+ void DemoApp::addMulti() { addTrigger( true ); };
- void delTrigger()
+ void DemoApp::delTrigger()
{
QListViewItem* item = l->selectedItem();
if ( !item )
{
QMessageBox::warning( 0, "Del Trigger", "<p>No trigger selected!</p>", "&Sorry", 0 );
return;
}
else
{
QString filename( item->text( 0 ) );
odebug << "Filename = " << filename << oendl;
}
}
- void trigger()
+ void DemoApp::trigger()
{
owarn << "FIRE!" << oendl;
}
-private:
- OListView* l;
- QButtonGroup* g1;
- QButtonGroup* g2;
- OFileNotificationType m;
-};
-
int main( int argc, char** argv )
{
DemoApp* app = new DemoApp( argc, argv );
app->exec();
return 0;
}
-#include "moc/onotifydemo.moc"
diff --git a/examples/opiecore/onotifydemo/onotifydemo.h b/examples/opiecore/onotifydemo/onotifydemo.h
new file mode 100644
index 0000000..c4e3456
--- a/dev/null
+++ b/examples/opiecore/onotifydemo/onotifydemo.h
@@ -0,0 +1,29 @@
+/* OPIE */
+#include <opie2/olistview.h>
+#include <opie2/odebug.h>
+#include <opie2/oapplication.h>
+#include <opie2/ofilenotify.h>
+
+class QButtonGroup;
+
+class DemoApp : public Opie::Core::OApplication
+{
+ Q_OBJECT
+public:
+ DemoApp( int argc, char** argv );
+
+public:
+ void addTrigger( bool multi = false );
+public slots:
+ void modifierClicked( int modifier );
+ void addSingle();
+ void addMulti();
+ void delTrigger();
+ void trigger();
+
+private:
+ Opie::Ui::OListView* l;
+ QButtonGroup* g1;
+ QButtonGroup* g2;
+ Opie::Core::OFileNotificationType m;
+};
diff --git a/examples/opiecore/onotifydemo/onotifydemo.pro b/examples/opiecore/onotifydemo/onotifydemo.pro
index 1c1040c..8e7e487 100644
--- a/examples/opiecore/onotifydemo/onotifydemo.pro
+++ b/examples/opiecore/onotifydemo/onotifydemo.pro
@@ -1,15 +1,15 @@
TEMPLATE = app
CONFIG = qt warn_on
-HEADERS =
+HEADERS = onotifydemo.h
SOURCES = onotifydemo.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lopiecore2 -lopieui2
TARGET = onotifydemo
!contains( platform, x11 ) {
include( $(OPIEDIR)/include.pro )
}
contains( platform, x11 ) {
LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib