2011-10-18 17:39:51 +02:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2014-01-11 16:11:42 +01:00
|
|
|
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
2011-10-18 17:39:51 +02:00
|
|
|
*
|
|
|
|
* 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 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
2014-03-09 21:51:42 +01:00
|
|
|
#ifndef PROFILEMANAGER_H
|
|
|
|
#define PROFILEMANAGER_H
|
2011-10-18 14:30:17 +02:00
|
|
|
|
2012-02-29 18:33:50 +01:00
|
|
|
#include <QString>
|
|
|
|
|
2014-02-26 20:03:20 +01:00
|
|
|
#include "qzcommon.h"
|
2011-10-18 14:30:17 +02:00
|
|
|
|
2014-03-09 21:51:42 +01:00
|
|
|
class ProfileManager
|
2011-10-18 14:30:17 +02:00
|
|
|
{
|
|
|
|
public:
|
2014-03-09 21:51:42 +01:00
|
|
|
explicit ProfileManager();
|
|
|
|
|
|
|
|
// Make sure the config dir exists and have correct structure
|
2015-09-28 20:44:15 +02:00
|
|
|
void initConfigDir();
|
2014-03-09 21:51:42 +01:00
|
|
|
// Set current profile name (from profiles.ini) and ensure dir exists with correct structure
|
|
|
|
void initCurrentProfile(const QString &profileName);
|
|
|
|
|
|
|
|
// Return 0 on success, -1 profile already exists, -2 cannot create directory
|
2015-09-28 20:44:15 +02:00
|
|
|
static int createProfile(const QString &profileName);
|
2014-03-09 21:51:42 +01:00
|
|
|
// Return false on error (profile does not exists)
|
2015-09-28 20:44:15 +02:00
|
|
|
static bool removeProfile(const QString &profileName);
|
2014-03-09 21:51:42 +01:00
|
|
|
|
|
|
|
// Name of current profile
|
2015-09-28 20:39:10 +02:00
|
|
|
static QString currentProfile();
|
2014-03-09 21:51:42 +01:00
|
|
|
|
|
|
|
// Name of starting profile
|
2015-09-28 20:39:10 +02:00
|
|
|
static QString startingProfile();
|
|
|
|
static void setStartingProfile(const QString &profileName);
|
2014-03-09 21:51:42 +01:00
|
|
|
|
|
|
|
// Names of available profiles
|
2015-09-28 20:39:10 +02:00
|
|
|
static QStringList availableProfiles();
|
2011-10-18 14:30:17 +02:00
|
|
|
|
|
|
|
private:
|
2014-03-09 21:51:42 +01:00
|
|
|
void updateCurrentProfile();
|
2011-10-18 14:30:17 +02:00
|
|
|
void updateProfile(const QString ¤t, const QString &profile);
|
|
|
|
void copyDataToProfile();
|
|
|
|
|
2014-03-09 21:51:42 +01:00
|
|
|
void connectDatabase();
|
|
|
|
|
2011-12-14 18:09:43 +01:00
|
|
|
void update100();
|
2012-04-02 19:33:05 +02:00
|
|
|
void update118();
|
2012-07-11 18:31:23 +02:00
|
|
|
void update120();
|
2012-07-16 13:59:24 +02:00
|
|
|
void update130();
|
2013-11-08 22:17:27 +01:00
|
|
|
void update140();
|
2014-09-26 10:35:35 +02:00
|
|
|
void update160();
|
2011-10-21 23:51:02 +02:00
|
|
|
|
2014-03-09 21:51:42 +01:00
|
|
|
bool m_databaseConnected;
|
2011-10-18 14:30:17 +02:00
|
|
|
};
|
|
|
|
|
2014-03-09 21:51:42 +01:00
|
|
|
#endif // PROFILEMANAGER_H
|