File: dialogs.h

package info (click to toggle)
qps 1.9.3-3.1
  • links: PTS
  • area: contrib
  • in suites: potato
  • size: 456 kB
  • ctags: 1,282
  • sloc: cpp: 8,565; makefile: 98; sh: 1
file content (85 lines) | stat: -rw-r--r-- 1,992 bytes parent folder | download | duplicates (3)
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
// dialogs.h			emacs, this is a -*-c++-*- file
//
// This program is free software. See the file COPYING for details.
// Author: Mattias Engdegrd, 1997-1999

// misc. handy dialogs for use everywhere

#ifndef DIALOGS_H
#define DIALOGS_H

#include <qdialog.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qpixmap.h>
#include <qslider.h>

// ValueDialog: modal dialog for input of a single value

class ValueDialog : public QDialog {
    Q_OBJECT
public:
    ValueDialog(const char *caption, const char *msg, const char *ed_txt);

protected slots:
    void done_dialog();

public:
    QString ed_result;

protected:
    QPushButton *ok, *cancel;
    QLabel *label;
    QLineEdit *lined;
};

// SliderDialog: value dialog with additional slider

class SliderDialog : public ValueDialog {
    Q_OBJECT
public:
    SliderDialog(const char *caption, const char *msg, int defaultval,
		 int minval, int maxval,
		 const char *leftlbl, const char *rightlbl);

protected slots:
    void slider_change(int val);

protected:
    QSlider *slider;
};

// MessageDialog: modal dialog that just gives a message
// (like QMessageBox but prettier)

class MessageDialog : public QDialog {
public:
    MessageDialog(QWidget *parent = 0);

    static void message(const char *caption, const char *text,
			const char *buttonText = 0, QPixmap *icon = 0);
    static QPixmap *warningIcon();

    void setText(const char *text);
    void setButtonText(const char *buttonText);
    void setPixmap(QPixmap *pixmap);

    void adjustSize();

private:
    // geometry constants:
    static const int button_minwidth = 64;
    static const int margin_top = 16;		// above text
    static const int margin_middle = 16;	// between text and button
    static const int margin_bottom = 16;	// below button
    static const int margin_side = 32;		// left and right of text

    QLabel *label;
    QPushButton *button;
    QLabel *icon;

    static QPixmap *warn_icon;
};

#endif	// DIALOGS_H