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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
/*
*
* $Id: k3bemptydiscwaiter.h 619556 2007-01-03 17:38:12Z trueg $
* Copyright (C) 2003-2007 Sebastian Trueg <trueg@k3b.org>
*
* This file is part of the K3b project.
* Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
*
* 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.
* See the file "COPYING" for the exact licensing terms.
*/
#ifndef K3BEMPTYDISCWAITER_H
#define K3BEMPTYDISCWAITER_H
#include <kdialogbase.h>
#include <k3bjobhandler.h>
#include <k3bdiskinfo.h>
namespace K3bDevice {
class Device;
class DeviceHandler;
}
/**
* Tests for an empty cd in a given device.
*
* Use the static wait methods.
*
* @author Sebastian Trueg
*/
class K3bEmptyDiscWaiter : public KDialogBase, public K3bJobHandler
{
Q_OBJECT
public:
~K3bEmptyDiscWaiter();
/**
* This should be replaced by the mediaType that was found or -1 for forced.
* MEDIA_NONE if canceled.
*/
enum returnValue { DISK_READY = 0,
CANCELED = -1 };
/**
* the same as waitForEmptyDisc( false );
*/
int exec();
/**
* @reimplemented from K3bJobHandler
* \internal do not use!
*/
int waitForMedia( K3bDevice::Device*,
int mediaState = K3bDevice::STATE_EMPTY,
int mediaType = K3bDevice::MEDIA_WRITABLE_CD,
const TQString& message = TQString() );
/**
* @reimplemented from K3bJobHandler
*/
bool questionYesNo( const TQString& text,
const TQString& caption = TQString(),
const TQString& yesText = TQString(),
const TQString& noText = TQString() );
/**
* reimplemented from K3bJobHandler
*/
void blockingInformation( const TQString& text,
const TQString& caption = TQString() );
/**
* This only openes a dialog if the first check failed.
*/
static int wait( K3bDevice::Device* device,
bool appendable = false,
int mediaType = K3bDevice::MEDIA_WRITABLE_CD,
TQWidget* parent = 0 );
/**
* Starts the emptydiskwaiter.
*
* \param mediaState a bitwise combination of the K3bDevice::State enum
* \param mediaType a bitwise combination of the K3bDevice::MediaType enum
* \return the found MediaType on success, 0 if forced and -1 if canceled
*/
static int wait( K3bDevice::Device*,
int mediaState,
int mediaType = K3bDevice::MEDIA_WRITABLE_CD,
const TQString& message = TQString(),
TQWidget* parent = 0 );
protected slots:
void slotCancel();
void slotUser1();
void slotUser2();
void slotUser3();
void slotMediumChanged( K3bDevice::Device* );
void showDialog();
void continueWaiting();
void slotErasingFinished( bool );
void slotReloadingAfterErasingFinished( K3bDevice::DeviceHandler* );
protected:
/**
* Use the static wait methods.
*/
explicit K3bEmptyDiscWaiter( K3bDevice::Device* device, TQWidget* parent = 0, const char* name = 0 );
int waitForDisc( int mediaState = K3bDevice::STATE_EMPTY,
int mediaType = K3bDevice::MEDIA_WRITABLE_CD,
const TQString& message = TQString() );
/**
* Nobody closes this dialog but itself!
*/
void closeEvent( TQCloseEvent* ) {}
private:
void finishWaiting( int );
void prepareErasingDialog();
TQWidget* parentWidgetToUse();
class Private;
Private* d;
};
#endif
|