File indexing completed on 2024-05-19 04:50:10

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Nikolaj Hald Nielsen <nhn@kde.org>                                *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016  
0017 #ifndef AMPACHECONFIG_H
0018 #define AMPACHECONFIG_H
0019 
0020 #include <QMap>
0021 #include <QStringList>
0022 #include <QUrl>
0023 
0024 class AmpacheServerEntry {
0025 
0026 public:
0027     QString name;
0028     QUrl url;
0029     QString username;
0030     QString password;
0031     bool addToCollection;
0032 };
0033 
0034 typedef QList< AmpacheServerEntry > AmpacheServerList;
0035 
0036 /**
0037 A class for accessing the Ampache plugin configuration
0038 
0039     @author 
0040 */
0041 class AmpacheConfig{
0042 public:
0043     
0044     AmpacheConfig();
0045     void load();
0046     void save();
0047 
0048     int serverCount() const;
0049     AmpacheServerList servers() const;
0050 
0051     void addServer( const AmpacheServerEntry &server );
0052     void removeServer( int index);
0053     void updateServer( int index, const AmpacheServerEntry &server );
0054 
0055 private:
0056 
0057     bool m_hasChanged;
0058     AmpacheServerList m_servers;
0059 
0060     // Disable copy constructor and assignment
0061     AmpacheConfig( const AmpacheConfig& );
0062     AmpacheConfig& operator=( const AmpacheConfig& );
0063 
0064 };
0065 
0066 #endif