File: CAbout.cpp

package info (click to toggle)
unixodbc 2.2.14p2-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 14,628 kB
  • ctags: 12,533
  • sloc: ansic: 104,243; cpp: 38,571; sh: 15,958; makefile: 2,727; sql: 1
file content (395 lines) | stat: -rw-r--r-- 14,568 bytes parent folder | download | duplicates (2)
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
/**************************************************
 *
 *
 **************************************************
 * This code was created by Peter Harvey @ CodeByDesign.
 * Released under GPL 31.JAN.99
 *
 * Contributions from...
 * -----------------------------------------------
 * Peter Harvey		- pharvey@codebydesign.com
 **************************************************/

#include "CAbout.h"
#include "about.xpm"

/*************************************************************
 *
 *************************************************************/

CAboutDiagram::CAboutDiagram( QWidget *pwidgetParent, const char *pszName )
	: QWidget( pwidgetParent, pszName )
{
    // LINES
	QFrame* qtarch_Frame_12;
	qtarch_Frame_12 = new QFrame( this, "Frame_12" );
	qtarch_Frame_12->setGeometry( 210, 60, 140, 10 );
	qtarch_Frame_12->setMinimumSize( 0, 0 );
	qtarch_Frame_12->setMaximumSize( 32767, 32767 );
#ifdef QT_V4LAYOUT
	qtarch_Frame_12->setFocusPolicy( Qt::NoFocus );
	qtarch_Frame_12->setBackgroundMode( Qt::PaletteBackground );
#else
	qtarch_Frame_12->setFocusPolicy( QWidget::NoFocus );
	qtarch_Frame_12->setBackgroundMode( QWidget::PaletteBackground );
#endif
	qtarch_Frame_12->setFrameStyle( 36 );

	QFrame* qtarch_Frame_8;
	qtarch_Frame_8 = new QFrame( this, "Frame_8" );
	qtarch_Frame_8->setGeometry( 90, 60, 150, 10 );
	qtarch_Frame_8->setMinimumSize( 0, 0 );
	qtarch_Frame_8->setMaximumSize( 32767, 32767 );
#ifdef QT_V4LAYOUT
	qtarch_Frame_8->setFocusPolicy( Qt::NoFocus );
	qtarch_Frame_8->setBackgroundMode( Qt::PaletteBackground );
#else
	qtarch_Frame_8->setFocusPolicy( QWidget::NoFocus );
	qtarch_Frame_8->setBackgroundMode( QWidget::PaletteBackground );
#endif
	qtarch_Frame_8->setFrameStyle( 36 );

	QFrame* qtarch_Frame_9;
	qtarch_Frame_9 = new QFrame( this, "Frame_9" );
	qtarch_Frame_9->setGeometry( 330, 60, 10, 70 );
	qtarch_Frame_9->setMinimumSize( 0, 0 );
	qtarch_Frame_9->setMaximumSize( 32767, 32767 );
#ifdef QT_V4LAYOUT
	qtarch_Frame_9->setFocusPolicy( Qt::NoFocus );
	qtarch_Frame_9->setBackgroundMode( Qt::PaletteBackground );
#else
	qtarch_Frame_9->setFocusPolicy( QWidget::NoFocus );
	qtarch_Frame_9->setBackgroundMode( QWidget::PaletteBackground );
#endif
	qtarch_Frame_9->setFrameStyle( 37 );

	QFrame* qtarch_Frame_7;
	qtarch_Frame_7 = new QFrame( this, "Frame_7" );
	qtarch_Frame_7->setGeometry( 70, 0, 10, 180 );
	qtarch_Frame_7->setMinimumSize( 0, 0 );
	qtarch_Frame_7->setMaximumSize( 32767, 32767 );
#ifdef QT_V4LAYOUT
	qtarch_Frame_7->setFocusPolicy( Qt::NoFocus );
	qtarch_Frame_7->setBackgroundMode( Qt::PaletteBackground );
#else
	qtarch_Frame_7->setFocusPolicy( QWidget::NoFocus );
	qtarch_Frame_7->setBackgroundMode( QWidget::PaletteBackground );
#endif
	qtarch_Frame_7->setFrameStyle( 37 );

    // PARTS BUTTONS
	QPushButton* qtarch_pbApplication;
	qtarch_pbApplication = new QPushButton( this, "pbApplication" );
	qtarch_pbApplication->setGeometry( 20, 0, 120, 30 );
	qtarch_pbApplication->setMinimumSize( 0, 0 );
	qtarch_pbApplication->setMaximumSize( 32767, 32767 );
	connect( qtarch_pbApplication, SIGNAL(clicked()), SLOT(pbApplication_Clicked()) );
#ifdef QT_V4LAYOUT
	qtarch_pbApplication->setFocusPolicy( Qt::TabFocus );
	qtarch_pbApplication->setBackgroundMode( Qt::PaletteBackground );
#else
	qtarch_pbApplication->setFocusPolicy( QWidget::TabFocus );
	qtarch_pbApplication->setBackgroundMode( QWidget::PaletteBackground );
#endif
	qtarch_pbApplication->setText( "Application" );
	qtarch_pbApplication->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
	qtarch_pbApplication->setAutoResize( FALSE );
#endif

	QPushButton* qtarch_pbDriverManager;
	qtarch_pbDriverManager = new QPushButton( this, "pbDriverManager" );
	qtarch_pbDriverManager->setGeometry( 20, 50, 120, 30 );
	qtarch_pbDriverManager->setMinimumSize( 0, 0 );
	qtarch_pbDriverManager->setMaximumSize( 32767, 32767 );
	connect( qtarch_pbDriverManager, SIGNAL(clicked()), SLOT(pbDriverManager_Clicked()) );
#ifdef QT_V4LAYOUT
	qtarch_pbDriverManager->setFocusPolicy( Qt::TabFocus );
	qtarch_pbDriverManager->setBackgroundMode( Qt::PaletteBackground );
#else
	qtarch_pbDriverManager->setFocusPolicy( QWidget::TabFocus );
	qtarch_pbDriverManager->setBackgroundMode( QWidget::PaletteBackground );
#endif
	qtarch_pbDriverManager->setText( "Driver Manager" );
	qtarch_pbDriverManager->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
	qtarch_pbDriverManager->setAutoResize( FALSE );
#endif

	QPushButton* qtarch_pbDriver;
	qtarch_pbDriver = new QPushButton( this, "pbDriver" );
	qtarch_pbDriver->setGeometry( 20, 100, 120, 30 );
	qtarch_pbDriver->setMinimumSize( 0, 0 );
	qtarch_pbDriver->setMaximumSize( 32767, 32767 );
	connect( qtarch_pbDriver, SIGNAL(clicked()), SLOT(pbDriver_Clicked()) );
#ifdef QT_V4LAYOUT
	qtarch_pbDriver->setFocusPolicy( Qt::TabFocus );
	qtarch_pbDriver->setBackgroundMode( Qt::PaletteBackground );
#else
	qtarch_pbDriver->setFocusPolicy( QWidget::TabFocus );
	qtarch_pbDriver->setBackgroundMode( QWidget::PaletteBackground );
#endif
	qtarch_pbDriver->setText( "Driver" );
	qtarch_pbDriver->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
	qtarch_pbDriver->setAutoResize( FALSE );
#endif

	QPushButton* qtarch_pbDatabase;
	qtarch_pbDatabase = new QPushButton( this, "pbDatabase" );
	qtarch_pbDatabase->setGeometry( 20, 150, 120, 30 );
	qtarch_pbDatabase->setMinimumSize( 0, 0 );
	qtarch_pbDatabase->setMaximumSize( 32767, 32767 );
	connect( qtarch_pbDatabase, SIGNAL(clicked()), SLOT(pbDatabase_Clicked()) );
#ifdef QT_V4LAYOUT
	qtarch_pbDatabase->setFocusPolicy( Qt::TabFocus );
	qtarch_pbDatabase->setBackgroundMode( Qt::PaletteBackground );
#else
	qtarch_pbDatabase->setFocusPolicy( QWidget::TabFocus );
	qtarch_pbDatabase->setBackgroundMode( QWidget::PaletteBackground );
#endif
	qtarch_pbDatabase->setText( "Database System" );
	qtarch_pbDatabase->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
	qtarch_pbDatabase->setAutoResize( FALSE );
#endif

	QPushButton* qtarch_pbODBC;
	qtarch_pbODBC = new QPushButton( this, "pbODBC" );
	qtarch_pbODBC->setGeometry( 160, 50, 115, 30 );
	qtarch_pbODBC->setMinimumSize( 0, 0 );
	qtarch_pbODBC->setMaximumSize( 32767, 32767 );
	connect( qtarch_pbODBC, SIGNAL(clicked()), SLOT(pbODBC_Clicked()) );
#ifdef QT_V4LAYOUT
	qtarch_pbODBC->setFocusPolicy( Qt::TabFocus );
	qtarch_pbODBC->setBackgroundMode( Qt::PaletteBackground );
#else
	qtarch_pbODBC->setFocusPolicy( QWidget::TabFocus );
	qtarch_pbODBC->setBackgroundMode( QWidget::PaletteBackground );
#endif
	qtarch_pbODBC->setText( "odbc.ini" );
	qtarch_pbODBC->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
	qtarch_pbODBC->setAutoResize( FALSE );
#endif

	QPushButton* qtarch_pbODBCDrivers;
	qtarch_pbODBCDrivers = new QPushButton( this, "pbODBCDrivers" );
	qtarch_pbODBCDrivers->setGeometry( 290, 100, 115, 30 );
	qtarch_pbODBCDrivers->setMinimumSize( 0, 0 );
	qtarch_pbODBCDrivers->setMaximumSize( 32767, 32767 );
	connect( qtarch_pbODBCDrivers, SIGNAL(clicked()), SLOT(pbODBCDrivers_Clicked()) );
#ifdef QT_V4LAYOUT
	qtarch_pbODBCDrivers->setFocusPolicy( Qt::TabFocus );
	qtarch_pbODBCDrivers->setBackgroundMode( Qt::PaletteBackground );
#else
	qtarch_pbODBCDrivers->setFocusPolicy( QWidget::TabFocus );
	qtarch_pbODBCDrivers->setBackgroundMode( QWidget::PaletteBackground );
#endif
	qtarch_pbODBCDrivers->setText( "odbcinst.ini" );
	qtarch_pbODBCDrivers->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
	qtarch_pbODBCDrivers->setAutoResize( FALSE );
#endif

	QPushButton* qtarch_pbConfig;
	qtarch_pbConfig = new QPushButton( this, "pbConfig" );
	qtarch_pbConfig->setGeometry( 290, 50, 115, 30 );
	qtarch_pbConfig->setMinimumSize( 0, 0 );
	qtarch_pbConfig->setMaximumSize( 32767, 32767 );
	connect( qtarch_pbConfig, SIGNAL(clicked()), SLOT(pbODBCConfig_Clicked()) );
#ifdef QT_V4LAYOUT
	qtarch_pbConfig->setFocusPolicy( Qt::TabFocus );
	qtarch_pbConfig->setBackgroundMode( Qt::PaletteBackground );
#else
	qtarch_pbConfig->setFocusPolicy( QWidget::TabFocus );
	qtarch_pbConfig->setBackgroundMode( QWidget::PaletteBackground );
#endif
	qtarch_pbConfig->setText( "Config" );
	qtarch_pbConfig->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
	qtarch_pbConfig->setAutoResize( FALSE );
#endif

	resize( 400,300 );
}


CAboutDiagram::~CAboutDiagram()
{
}

void CAboutDiagram::pbODBC_Clicked()
{
    QString qsMsg;

    qsMsg = "This is the main configuration file for ODBC.\n";
    qsMsg += "It contains Data Source configuration. \n";
    qsMsg += "It is used by the Driver Manager to determine, from a given Data\n";
    qsMsg += "Source Name, such things as the name of the Driver.\n";
    qsMsg += "It is a simple text file but is configured using the ODBCConfig tool.\n";
    qsMsg += "The User data sources are typically stored in ~/.odbc.ini while the\n";
    qsMsg += "System data sources are stored in /etc/odbc.ini\n";
    QMessageBox::information( this, "ODBC Config - odbc.ini", qsMsg );
}

void CAboutDiagram::pbODBCConfig_Clicked()
{
    QString qsMsg;

    qsMsg = "This is the program you are using now. This\n";
    qsMsg += "program allows the user to easily configure ODBC.\n";
    QMessageBox::information( this, "ODBC Config", qsMsg );
}

void CAboutDiagram::pbDatabase_Clicked()
{
    QString qsMsg;

    qsMsg = "Perhaps the most common type of Database System today is an SQL Server. ";
    qsMsg += "\n\nSQL Servers with Heavy Functionality;";
    qsMsg += "\n  ADABAS-D";
    qsMsg += "\n  Empress";
    qsMsg += "\n  Informix";
    qsMsg += "\n  Sybase - www.sybase.com";
    qsMsg += "\n  Oracle - www.oracle.com";
    qsMsg += "\n\nSQL Servers with Lite Functionality;";
    qsMsg += "\n  MiniSQL";
    qsMsg += "\n  MySQL";
    qsMsg += "\n  Solid";
    qsMsg += "\n\nThe Database System may be running on the local machine or on a ";
    qsMsg += "remote machine. It may also store its information in a variety of\n";
    qsMsg += "ways. This does not matter to an ODBC application because the Driver\n";
    qsMsg += "Manager and the Driver provides a consistent interface to the Database System.\n";
    QMessageBox::information( this, "ODBC Config - Database System", qsMsg );
}

void CAboutDiagram::pbDriverManager_Clicked()
{
    QString qsMsg;

    qsMsg = "The Driver Manager carries out a number of functions such as;\n";
    qsMsg += "1. resolves Data Source Names (via odbcinst lib)\n";
    qsMsg += "2. loads any required drivers\n";
    qsMsg += "3. calls the drivers exposed functions to communicate with the database\n";
    qsMsg += "Some functionality, such as listing all Data Sources, is only present\n";
    qsMsg += "in the Driver Manager (or via odbcinst lib).\n";
    qsMsg += "\n";
    QMessageBox::information( this, "ODBC Config - Driver Manager", qsMsg );
}

void CAboutDiagram::pbDriver_Clicked()
{
    QString qsMsg;

    qsMsg = "The ODBC Drivers contain code specific to a Database\n";
    qsMsg += "System and provides a set of callable functions to the\n";
    qsMsg += "Driver Manager.\n";
    qsMsg += "Drivers may implement some database functionality when it\n";
    qsMsg += "is required by ODBC and is not present in the Database System.\n";
    qsMsg += "Drivers may also translate data types.\n";
    qsMsg += "\n";
    qsMsg += "ODBC Drivers can be obtained from the Internet or directly\n";
    qsMsg += "from the Database vendor.\n";
    qsMsg += "\n";
    qsMsg += "Check http://www.unixodbc.org for drivers\n";
    QMessageBox::information( this, "ODBC Config - Drivers", qsMsg );
}

void CAboutDiagram::pbODBCDrivers_Clicked()
{
    QString qsMsg;

    qsMsg = "odbcinst.ini contains a list of all installed ODBC\n";
    qsMsg += "Drivers. Each entry also contains some information\n";
    qsMsg += "about the driver such as the file name(s) of the driver.\n";
    qsMsg += "\n";
    qsMsg += "An entry should be made when an ODBC driver is installed\n";
    qsMsg += "and removed when the driver is uninstalled. This\n";
    qsMsg += "can be done using ODBCConfig or the odbcinst command tool.\n";
    QMessageBox::information( this, "ODBC Config - odbcinst.ini", qsMsg );
}

void CAboutDiagram::pbApplication_Clicked()
{
    QString qsMsg;

    qsMsg = "The Application communicates with the Driver Manager\n";
    qsMsg += "using the standard ODBC calls.\n";
    qsMsg += "The Application does not care; where the data is stored,\n";
    qsMsg += "how it is stored or even how the system is configured to\n";
    qsMsg += "access the data.\n";
    qsMsg += "The Application only needs to know the Data Source Name (DSN).\n";
    qsMsg += "\n";
    qsMsg += "The Application is NOT hard-wired to a particular Database\n";
    qsMsg += "System. This allows the user to choose a different Database\n";
    qsMsg += "System using the ODBCConfig tool.\n";
    QMessageBox::information( this, "ODBC Config - Application", qsMsg );
}

/*************************************************************
 *
 *************************************************************/

CAbout::CAbout( QWidget *pwidgetParent, const char *pszName )
	: QWidget( pwidgetParent, pszName )
{
    QVBoxLayout *   playoutTop;
    QHBoxLayout *   playoutHelp;
    CAboutDiagram * pdiagram;
    QFrame *        pframeHelp;
	QLabel *        plabelIcon;
	QLabel *        plabelText;
	QPushButton *   ppushbuttonCredits;

    playoutTop          = new QVBoxLayout( this, 5 );

    // DIAGRAM
    pdiagram            = new CAboutDiagram( this );

    playoutTop->addWidget( pdiagram, 10 );

    // HELP - FRAME
    pframeHelp          = new QFrame( this );
    pframeHelp->setFrameStyle( QFrame::Box | QFrame::Raised );

    playoutTop->addWidget( pframeHelp );

    //
    playoutHelp         = new QHBoxLayout( pframeHelp, 5 );

	plabelIcon          = new QLabel( pframeHelp );
    plabelIcon->setPixmap( xpmAbout );

	plabelText          = new QLabel( pframeHelp );
	plabelText->setText( "Open DataBase Connectivity (ODBC) was developed to be an Open and portable standard for accessing data. unixODBC implements this standard for Linux/UNIX.\nhttp://www.unixodbc.org" );
#ifdef QT_V4LAYOUT
	plabelText->setAlignment(  Qt::AlignLeft | Qt::WordBreak  );
  	plabelText->setWordWrap( true );
#else
	plabelText->setAlignment(  AlignLeft | WordBreak  );
#endif

	ppushbuttonCredits  = new QPushButton( pframeHelp );
	connect( ppushbuttonCredits, SIGNAL(clicked()), SLOT(pbCredits_Clicked()) );
	ppushbuttonCredits->setText( "&Credits" );

    playoutHelp->addWidget( plabelIcon );
    playoutHelp->addWidget( plabelText, 10 );
    playoutHelp->addWidget( ppushbuttonCredits );
}


CAbout::~CAbout()
{
}

void CAbout::pbCredits_Clicked()
{
    CCredits *pcredits = new CCredits( this );
    pcredits->exec();

    delete pcredits;
}