2009-04-30 15:29:03 +00:00
|
|
|
/* This file is (c) 2008-2009 Konstantin Isakov <ikm@users.berlios.de>
|
|
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
|
|
|
|
#ifndef __EDITDICTIONARIES_HH_INCLUDED__
|
|
|
|
#define __EDITDICTIONARIES_HH_INCLUDED__
|
|
|
|
|
|
|
|
#include "dictionary.hh"
|
|
|
|
#include "config.hh"
|
|
|
|
#include "ui_editdictionaries.h"
|
|
|
|
#include "sources.hh"
|
2009-05-18 18:01:50 +00:00
|
|
|
#include "orderandprops.hh"
|
2009-04-30 15:29:03 +00:00
|
|
|
#include "groups.hh"
|
2009-05-15 12:15:08 +00:00
|
|
|
#include "instances.hh"
|
2009-04-30 15:29:03 +00:00
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
|
|
|
|
class EditDictionaries: public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
EditDictionaries( QWidget * parent, Config::Class & cfg,
|
|
|
|
std::vector< sptr< Dictionary::Class > > & dictionaries,
|
2009-05-15 12:15:08 +00:00
|
|
|
Instances::Groups & groupInstances, // We only clear those on rescan
|
2009-04-30 15:29:03 +00:00
|
|
|
QNetworkAccessManager & dictNetMgr );
|
|
|
|
|
|
|
|
/// Returns true if any changes to the 'dictionaries' vector passed were done.
|
|
|
|
bool areDictionariesChanged() const
|
|
|
|
{ return dictionariesChanged; }
|
|
|
|
|
|
|
|
/// Returns true if groups were changed.
|
|
|
|
bool areGroupsChanged() const
|
|
|
|
{ return groupsChanged; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual void accept();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
void on_tabs_currentChanged( int index );
|
|
|
|
|
2009-05-05 08:57:37 +00:00
|
|
|
void rescanSources();
|
|
|
|
|
2009-04-30 15:29:03 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
bool isSourcesChanged() const;
|
|
|
|
|
2009-05-15 12:39:53 +00:00
|
|
|
void acceptChangedSources( bool rebuildGroups );
|
2009-04-30 15:29:03 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
Config::Class & cfg;
|
|
|
|
std::vector< sptr< Dictionary::Class > > & dictionaries;
|
2009-05-15 12:15:08 +00:00
|
|
|
Instances::Groups & groupInstances;
|
2009-04-30 15:29:03 +00:00
|
|
|
QNetworkAccessManager & dictNetMgr;
|
|
|
|
|
|
|
|
// Backed up to decide later if something was changed or not
|
|
|
|
Config::Class origCfg;
|
|
|
|
|
|
|
|
Ui::EditDictionaries ui;
|
|
|
|
Sources sources;
|
2009-05-18 18:01:50 +00:00
|
|
|
sptr< OrderAndProps > orderAndProps;
|
2009-04-30 15:29:03 +00:00
|
|
|
sptr< Groups > groups;
|
|
|
|
|
|
|
|
bool dictionariesChanged;
|
|
|
|
bool groupsChanged;
|
|
|
|
|
|
|
|
int lastCurrentTab;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|