hydrogen 1.2.3
SoundLibraryRepositoryDialog.cpp
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 * Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
5 *
6 * http://www.hydrogen-music.org
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY, without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see https://www.gnu.org/licenses
20 *
21 */
22
24
26
27#include <QList>
28#include <QInputDialog>
29#include <QListWidgetItem>
30
32 : QDialog( pParent )
33 {
34 setupUi( this );
35
36 setWindowTitle( tr( "Edit repository settings" ) );
37 adjustSize();
38 setMinimumSize( width(), height() );
39
41
42}
43
44
45//update all values
47
49
50 /*
51 Read serverList from config and put servers into the serverList
52 */
53
54 std::list<QString>::const_iterator cur_Server;
55
56 ServerListWidget->clear();
57
58 for( cur_Server = pPref->sServerList.begin(); cur_Server != pPref->sServerList.end(); ++cur_Server )
59 {
60 ServerListWidget->addItem( *cur_Server );
61 }
62}
63
64
65
68
70{
72 bool ok;
73
74 QString text = QInputDialog::getText(this, tr("Edit server list"), tr("URL"), QLineEdit::Normal,QString(""), &ok);
75
76 if( ok && !text.isEmpty() ){
77 pPref->sServerList.push_back( text );
78 }
79
81}
82
87{
88 QList<QListWidgetItem *> selectedItems;
89 selectedItems = ServerListWidget->selectedItems();
90
91 //std::list<std::string>::const_iterator cur_Server;
93
94 while( ! selectedItems.isEmpty() ){
95
96 QString selText;
97
98 selText = selectedItems.takeFirst()->text();
99
100 pPref->sServerList.remove(selText);
101
102 }
103 updateDialog();
104}
105
110
#define INFOLOG(x)
Definition Object.h:237
Manager for User Preferences File (singleton)
Definition Preferences.h:78
static Preferences * get_instance()
Returns a pointer to the current Preferences singleton stored in __instance.
std::list< QString > sServerList
void on_DeleteBtn_clicked()
Delete serverList entry.