QtDcmPreferencesWidget.cpp
Go to the documentation of this file.
1 /*
2  QtDcm is a C++ Qt based library for communication and conversion of Dicom images.
3  Copyright (C) 2011 Alexandre Abadie <Alexandre.Abadie@univ-rennes1.fr>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 
20 #include "QtDcmPreferencesWidget.h"
21 #include "QtDcmPreferences.h"
22 #include "QtDcmServer.h"
23 
25  : QWidget(parent)
26 {
27  setupUi ( this );
28 
29 // treeWidget->setColumnWidth ( 1, 100 );
30 // treeWidget->setColumnWidth ( 2, 100 );
31 // treeWidget->setColumnWidth ( 3, 150 );
32 //
33 // serverNameEdit->setEnabled ( false );
34 // serverAetitleEdit->setEnabled ( false );
35 // serverPortEdit->setEnabled ( false );
36 // serverHostnameEdit->setEnabled ( false );
37 // removeButton->setEnabled ( false );
38 // echoButton->setEnabled ( false );
39 
40 // this->initConnections();
41 
42 }
43 
45 {
46 }
47 
49 {
50  localDicomSettingsWidget->readPreferences();
51  serversDicomSettingsWidget->readPreferences();
52 }
53 
55 {
56 // d->preferences->setAetitle ( localAetitleEdit->text() );
57 // d->preferences->setPort ( localPortEdit->text() );
58 // d->preferences->setHostname ( localHostnameEdit->text() );
59 // QTreeWidgetItem * root = treeWidget->invisibleRootItem();
60 //
61 // for ( int i = 0; i < d->preferences->getServers().size(); i++ )
62 // {
63 // d->preferences->getServers().at ( i )->setName ( root->child ( i )->data ( 0, 1 ).toString() );
64 // d->preferences->getServers().at ( i )->setAetitle ( root->child ( i )->data ( 1, 1 ).toString() );
65 // d->preferences->getServers().at ( i )->setPort ( root->child ( i )->data ( 2, 1 ).toString() );
66 // d->preferences->getServers().at ( i )->setServer ( root->child ( i )->data ( 3, 1 ).toString() );
67 // }
68 
69  localDicomSettingsWidget->updatePreferences();
70  serversDicomSettingsWidget->updatePreferences();
71 
72 // d->preferences->writeSettings();
73 }
74 
75 // void QtDcmPreferencesWidget::itemSelected ( QTreeWidgetItem* current, QTreeWidgetItem* previous )
76 // {
77 // echoButton->setEnabled ( true );
78 // removeButton->setEnabled ( true );
79 // serverNameEdit->setEnabled ( true );
80 // serverAetitleEdit->setEnabled ( true );
81 // serverPortEdit->setEnabled ( true );
82 // serverHostnameEdit->setEnabled ( true );
83 // serverNameEdit->setText ( current->data ( 0, 1 ).toString() );
84 // serverAetitleEdit->setText ( current->data ( 1, 1 ).toString() );
85 // serverPortEdit->setText ( current->data ( 2, 1 ).toString() );
86 // serverHostnameEdit->setText ( current->data ( 3, 1 ).toString() );
87 // }
88 //
89 // void QtDcmPreferencesWidget::serverNameChanged ( QString text )
90 // {
91 // treeWidget->currentItem()->setText ( 0, text );
92 // treeWidget->currentItem()->setData ( 0, 1, QVariant ( text ) );
93 // }
94 //
95 // void QtDcmPreferencesWidget::serverAetitleChanged ( QString text )
96 // {
97 // QRegExp rexp ( "[A-Z0-9._-]{1,50}" );
98 // QRegExpValidator * valid = new QRegExpValidator ( rexp, this );
99 // serverAetitleEdit->setValidator ( valid );
100 // treeWidget->currentItem()->setText ( 1, text );
101 // treeWidget->currentItem()->setData ( 1, 1, QVariant ( text ) );
102 // }
103 //
104 // void QtDcmPreferencesWidget::serverPortChanged ( QString text )
105 // {
106 // QIntValidator * valid = new QIntValidator ( 1000, 100000, this );
107 // serverPortEdit->setValidator ( valid );
108 // treeWidget->currentItem()->setText ( 2, text );
109 // treeWidget->currentItem()->setData ( 2, 1, QVariant ( text ) );
110 // }
111 //
112 // void QtDcmPreferencesWidget::serverHostnameChanged ( QString text )
113 // {
114 // treeWidget->currentItem()->setText ( 3, text );
115 // treeWidget->currentItem()->setData ( 3, 1, QVariant ( text ) );
116 // }
117 //
118 // void QtDcmPreferencesWidget::addServer()
119 // {
120 // QTreeWidgetItem * item = new QTreeWidgetItem ( treeWidget );
121 // d->preferences->addServer();
122 // item->setText ( 0, "Name" );
123 // item->setData ( 0, 1, QVariant ( "Name" ) );
124 // d->preferences->getServers().last()->setName ( "Name" );
125 // item->setText ( 1, "AETITLE" );
126 // item->setData ( 1, 1, QVariant ( "AETITLE" ) );
127 // d->preferences->getServers().last()->setAetitle ( "AETITLE" );
128 // item->setText ( 2, "2010" );
129 // d->preferences->getServers().last()->setPort ( "2010" );
130 // item->setData ( 2, 1, QVariant ( 2010 ) );
131 // item->setText ( 3, "hostname" );
132 // item->setData ( 3, 1, QVariant ( "hostname" ) );
133 // item->setData ( 4, 1, QVariant ( d->preferences->getServers().size() - 1 ) );
134 // d->preferences->getServers().last()->setServer ( "hostname" );
135 // }
136 //
137 // void QtDcmPreferencesWidget::removeServer()
138 // {
139 // QTreeWidgetItem * root = treeWidget->invisibleRootItem();
140 // d->preferences->removeServer ( root->indexOfChild ( treeWidget->currentItem() ) );
141 //
142 // if ( root->childCount() == 0 )
143 // {
144 // echoButton->setEnabled ( false );
145 // removeButton->setEnabled ( false );
146 // }
147 // else if ( root->childCount() == 1 )
148 // {
149 // treeWidget->reset();
150 // treeWidget->clear();
151 // removeButton->setEnabled ( false );
152 // echoButton->setEnabled ( false );
153 // }
154 // else
155 // root->removeChild ( treeWidget->currentItem() );
156 // }
QtDcmPreferencesWidget(QWidget *parent=0)