void QtDcmServersDicomSettingsWidget::addServer()
{
    QtDcmPreferences* prefs = QtDcmPreferences::instance();
    QTreeWidgetItem * item = new QTreeWidgetItem ( treeWidget );
    QtDcmServer server;
    server.setName("Name");
    server.setAetitle("AETITLE");
    server.setPort("2010");
    server.setAddress("hostname");
    
    item->setText ( 0, server.name() );
    item->setData ( 0, 1, QVariant ( server.name() ) );
    
    item->setText ( 1, server.aetitle() );
    item->setData ( 1, 1, QVariant ( server.aetitle() ) );
    
    item->setText ( 2, server.port() );
    item->setData ( 2, 1, QVariant ( server.port().toInt() ) );
    
    item->setText ( 3, server.address() );
    item->setData ( 3, 1, QVariant ( server.address() ) );
    
    item->setData ( 4, 1, QVariant ( prefs->servers().size() - 1 ) );
    
    prefs->addServer(server);
}
void QtDcmServersDicomSettingsWidget::updatePreferences()
{   
    QtDcmPreferences* prefs = QtDcmPreferences::instance();
    QTreeWidgetItem * root = treeWidget->invisibleRootItem();
    
    QList<QtDcmServer> servers;
    for (int i = 0; i < root->childCount() ; i++) {
        QtDcmServer server;
        server.setName(root->child ( i )->data ( 0, 1 ).toString());
        server.setAetitle(root->child ( i )->data ( 1, 1 ).toString());
        server.setPort(root->child ( i )->data ( 2, 1 ).toString());
        server.setAddress(root->child ( i )->data ( 3, 1 ).toString());
        servers << server;
    }
    
    prefs->setServers(servers);
}
Esempio n. 3
0
void QtDcmPreferences::setDefaultIniFile()
{
    //Create an ini file with default parameters
    d->aetitle = "QTDCM";
    d->port = "2010";
    d->hostname = "localhost";

    d->dcm2niiPath = "";
    d->useDcm2nii = 0;

    QtDcmServer * server = new QtDcmServer();
    server->setAetitle ( "SERVER" );
    server->setServer ( "hostname" );
    server->setName ( "Server" + QString::number ( d->servers.size() + 1 ) );
    server->setPort ( "11112" );
    d->servers.append ( server );
    this->writeSettings();
}