2
* growltest.cpp: A test program for the GrowlNotifier class
3
* Copyright (C) 2005 Remko Troncon
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* You can also redistribute and/or modify this program under the
11
* terms of the Psi License, specified in the accompanied COPYING
12
* file, as published by the Psi Project; either dated January 1st,
13
* 2005, or (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this library; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
#include "growlnotifier.h"
28
#include <qstringlist.h>
29
#include <qapplication.h>
30
#include <qmessagebox.h>
31
#include <qpushbutton.h>
34
#include <qlineedit.h>
35
#include <qcheckbox.h>
38
class GrowlTestWidget : public QWidget
43
GrowlTestWidget( QWidget *parent=0, const char *name=0 );
46
void do_notification1();
47
void do_notification2();
48
void notification_clicked();
51
QLineEdit *text, *title;
53
GrowlNotifier* growlNotifier;
57
GrowlTestWidget::GrowlTestWidget( QWidget *parent, const char *name ) : QWidget(parent, name)
60
QGridLayout *layout = new QGridLayout(this,4,2);
62
layout->addWidget(new QLabel("Title",this),0,0);
63
title = new QLineEdit(this);
64
title->setText("My Text");
65
layout->addWidget(title,0,1);
67
layout->addWidget(new QLabel("Text",this),1,0);
68
text = new QLineEdit(this);
69
text->setText("My Description");
70
layout->addWidget(text,1,1);
72
//layout->addWidget(new QLabel("Sticky",this),2,0);
73
//sticky = new QCheckBox(this);
74
//sticky->setTristate();
75
//layout->addWidget(sticky,2,1);
77
QPushButton *notification1 = new QPushButton( "Notification 1", this );
78
connect(notification1, SIGNAL(clicked()), SLOT(do_notification1()));
79
layout->addWidget(notification1,3,0);
81
QPushButton *notification2 = new QPushButton( "Notification 2", this );
82
connect(notification2, SIGNAL(clicked()), SLOT(do_notification2()));
83
layout->addWidget(notification2,3,1);
85
// Initialize GrowlNotifier
86
QStringList nots, defaults;
87
nots << "Notification 1" << "Notification 2";
88
defaults << "Notification 1";
89
growlNotifier = new GrowlNotifier(nots, defaults, "GrowlNotifierTest");
92
int main( int argc, char **argv )
94
QApplication a( argc, argv );
96
a.setMainWidget( &w );
101
void GrowlTestWidget::do_notification1()
103
//if (sticky->state() != QButton::NoChange) {
104
growlNotifier->notify("Notification 1", title->text(), text->text(), QPixmap(), sticky->isChecked(), this, SLOT(notification_clicked()));
107
// growlNotifier->notify("Notification 1", title->text(), text->text(), QPixmap());
111
void GrowlTestWidget::do_notification2()
113
//if (sticky->state() != QButton::NoChange) {
114
growlNotifier->notify("Notification 2", title->text(), text->text(), QPixmap(), sticky->isChecked(), this, SLOT(notification_clicked()));
117
// growlNotifier->notify("Notification 2", title->text(), text->text(), QPixmap());
121
void GrowlTestWidget::notification_clicked()
123
QMessageBox::information(0, "Information", "Notification was clicked\n");
126
#include "growltest.moc"