1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/*
* Copyright (c) 2007, Aconex. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef KMQUERY_H
#define KMQUERY_H
#include <QtCore/QVariant>
#include <QtCore/QTimerEvent>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QDialog>
#include <QtGui/QGridLayout>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QTextEdit>
#include <QtGui/QPushButton>
#include <QtGui/QSpacerItem>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>
#include <cstdio>
class PmQuery : public QDialog
{
Q_OBJECT
public:
PmQuery(bool inputflag, bool printflag, bool noframeflag,
bool nosliderflag, bool usesliderflag, bool exclusiveflag);
void setStatus(int status) { my.status = status; }
static void setTitle(char *string);
static int setTimeout(char *string);
static int setIcontype(char *string);
static int messageCount();
static void addMessage(char *string);
static int buttonCount();
static void addButton(const char *string, bool iamdefault, int exitstatus);
static void addButtons(char *stringlist);
static void setDefaultButton(char *string);
public slots:
void buttonClicked();
protected:
void timerEvent(QTimerEvent *);
private:
struct {
int status;
} my;
};
class QueryButton : public QPushButton
{
Q_OBJECT
public:
QueryButton(bool out, QWidget *p) : QPushButton(NULL, p)
{
my.s = 0;
my.k = NULL;
my.l = NULL;
my.t = NULL;
if (out)
connect(this, SIGNAL(clicked()), this, SLOT(print()));
else
connect(this, SIGNAL(clicked()), this, SLOT(noprint()));
}
void setQuery(PmQuery *dialog) { my.k = dialog; }
void setStatus(int status) { my.s = status; }
void setEditor(QLineEdit *editor) { my.l = editor; }
void setEditor(QTextEdit *editor) { my.t = editor; }
public slots:
void print()
{
noprint(); puts(my.l ? my.l->text().toAscii().data() : (my.t?
my.t->toPlainText().toAscii().data() : text().toAscii().data()));
}
void noprint() { my.k->setStatus(my.s); }
private:
struct {
int s;
PmQuery *k;
QLineEdit *l;
QTextEdit *t;
} my;
};
#endif // KMQUERY_H
|