File: MYODBCSetupDataSourceTab1.cpp

package info (click to toggle)
myodbc 3.51.11-6.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,056 kB
  • ctags: 1,933
  • sloc: ansic: 31,656; sh: 10,955; cpp: 2,439; makefile: 1,120
file content (169 lines) | stat: -rw-r--r-- 7,022 bytes parent folder | download
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
/* Copyright (C) 2000-2005 MySQL AB

   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.

   There are special exceptions to the terms and conditions of the GPL as it
   is applied to this software. View the full text of the exception in file
   EXCEPTIONS in the directory of this software distribution.

   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.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#include "MYODBCSetupDataSourceTab1.h"

MYODBCSetupDataSourceTab1::MYODBCSetupDataSourceTab1( QWidget *pwidgetParent,
                                                      QString stringDataSourceName,
                                                      QString stringDescription,
                                                      QString stringServer,
                                                      QString stringUser,
                                                      QString stringPassword,
                                                      QString stringDatabase )
    : QWidget( pwidgetParent, "MYODBCSetupDataSourceTab1" )
{
    doInit();
    plineeditDataSourceName->setText( stringDataSourceName );
    plineeditDescription->setText( stringDescription );
    plineeditServer->setText( stringServer );
    plineeditUser->setText( stringUser );
    plineeditPassword->setText( stringPassword );
    pcomboboxDatabase->lineEdit()->setText( stringDatabase );
}

MYODBCSetupDataSourceTab1::MYODBCSetupDataSourceTab1( QWidget *pwidgetParent )
    : QWidget( pwidgetParent, "MYODBCSetupDataSourceTab1" )
{
    doInit();
}

void MYODBCSetupDataSourceTab1::setDataSourceName( const QString &stringDataSourceName )
{
    plineeditDataSourceName->setText( stringDataSourceName );
}

void MYODBCSetupDataSourceTab1::setDescription( const QString &stringDescription )
{
    plineeditDescription->setText( stringDescription );
}

void MYODBCSetupDataSourceTab1::setServer( const QString &stringServer )
{
    plineeditServer->setText( stringServer );
}

void MYODBCSetupDataSourceTab1::setUser( const QString &stringUser )
{
    plineeditUser->setText( stringUser );
}

void MYODBCSetupDataSourceTab1::setPassword( const QString &stringPassword )
{
    plineeditPassword->setText( stringPassword );
}

void MYODBCSetupDataSourceTab1::setDatabase( const QString &stringDatabase )
{
    pcomboboxDatabase->lineEdit()->setText( stringDatabase );
}

QString MYODBCSetupDataSourceTab1::getDataSourceName()
{
    return plineeditDataSourceName->text();
}

QString MYODBCSetupDataSourceTab1::getDescription()
{
    return plineeditDescription->text();
}

QString MYODBCSetupDataSourceTab1::getServer()
{
    return plineeditServer->text();
}

QString MYODBCSetupDataSourceTab1::getUser()
{
    return plineeditUser->text();
}

QString MYODBCSetupDataSourceTab1::getPassword()
{
    return plineeditPassword->text();
}

QString MYODBCSetupDataSourceTab1::getDatabase()
{
    return pcomboboxDatabase->lineEdit()->text();
}

void MYODBCSetupDataSourceTab1::doInit()
{
    QGridLayout *playoutFields = new QGridLayout( this, 7, 5 );
    playoutFields->setMargin( 20 );
    playoutFields->setSpacing( 5 );

    int nRow = 0;
    int nColLabel = 1;
    int nColField = 3;

    plabelDataSourceName = new QLabel( "Data Source Name", this );
    plineeditDataSourceName = new MYODBCSetupLineEdit( this );
    plineeditDataSourceName->setAssistText( "A unique name for this data source.\nOptional: No\nDefault: myodbc" );
    QToolTip::add( plineeditDataSourceName, "A unique name for this data source.\nOptional: No\nDefault: myodbc" );
    playoutFields->addWidget( plabelDataSourceName, nRow, nColLabel );
    playoutFields->addWidget( plineeditDataSourceName, nRow, nColField );
    nRow++;

    plabelDescription = new QLabel( "Description", this );
    plineeditDescription = new MYODBCSetupLineEdit( this );
    plineeditDescription->setAssistText( "A brief description of this data source.\nOptional: Yes\nDefault: <empty>" );
    QToolTip::add( plineeditDescription, "A brief description of this data source.\nOptional: Yes\nDefault: <empty>" );
    playoutFields->addWidget( plabelDescription, nRow, nColLabel );
    playoutFields->addWidget( plineeditDescription, nRow, nColField );
    nRow++;

    plabelServer = new QLabel( "Server", this );
    plineeditServer = new MYODBCSetupLineEdit( this );
    plineeditServer->setText( "localhost" );
    plineeditServer->setAssistText( "The hostname of the MySQL server.\nOptional: Yes (silently uses default)\nDefault: localhost" );
    QToolTip::add( plineeditServer, "The hostname of the MySQL server.\nOptional: Yes (silently uses default)\nDefault: localhost" );
    playoutFields->addWidget( plabelServer, nRow, nColLabel );
    playoutFields->addWidget( plineeditServer, nRow, nColField );
    nRow++;

    plabelUser = new QLabel( "User", this );
    plineeditUser = new MYODBCSetupLineEdit( this );
    plineeditUser->setAssistText( "The username used to connect to MySQL.\nOptional: Yes (silently uses default)\nDefault (Windows only): ODBC" );
    QToolTip::add( plineeditUser, "The username used to connect to MySQL.\nOptional: Yes (silently uses default)\nDefault (Windows only): ODBC" );
    playoutFields->addWidget( plabelUser, nRow, nColLabel );
    playoutFields->addWidget( plineeditUser, nRow, nColField );
    nRow++;

    plabelPassword = new QLabel( "Password", this );
    plineeditPassword = new MYODBCSetupLineEdit( this );
    plineeditPassword->setEchoMode( QLineEdit::Password );
    plineeditPassword->setAssistText( "The password for the server user combination.\nOptional: Yes\nDefault: <empty>" );
    QToolTip::add( plineeditPassword, "The password for the server user combination.\nOptional: Yes\nDefault: <empty>" );
    playoutFields->addWidget( plabelPassword, nRow, nColLabel );
    playoutFields->addWidget( plineeditPassword, nRow, nColField );
    nRow++;

    plabelDatabase = new QLabel( "Database", this );
    pcomboboxDatabase = new MYODBCSetupComboBoxDatabases( this );
    pcomboboxDatabase->setAssistText( "The database to be current upon connect.\nOptional: Yes\nDefault: <none>" );
    QToolTip::add( pcomboboxDatabase, "The database to be current upon connect.\nOptional: Yes\nDefault: <none>" );
    playoutFields->addWidget( plabelDatabase, nRow, nColLabel );
    playoutFields->addWidget( pcomboboxDatabase, nRow, nColField );
    connect( pcomboboxDatabase, SIGNAL(signalLoadRequest()), SIGNAL(signalRequestDatabaseNames()) );
    nRow++;
}