2012-02-20 21:47:14 +00:00
|
|
|
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
|
2009-04-30 15:29:03 +00:00
|
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
|
|
|
|
#ifndef __EDITDICTIONARIES_HH_INCLUDED__
|
|
|
|
#define __EDITDICTIONARIES_HH_INCLUDED__
|
|
|
|
|
|
|
|
#include "config.hh"
|
2023-05-30 06:31:07 +00:00
|
|
|
#include "dict/dictionary.hh"
|
2023-04-17 20:55:34 +00:00
|
|
|
#include "dict/sources.hh"
|
2009-04-30 15:29:03 +00:00
|
|
|
#include "groups.hh"
|
2009-05-15 12:15:08 +00:00
|
|
|
#include "instances.hh"
|
2023-05-30 06:31:07 +00:00
|
|
|
#include "orderandprops.hh"
|
|
|
|
#include "ui_editdictionaries.h"
|
2014-06-24 13:55:06 +00:00
|
|
|
#include <QAction>
|
2023-05-30 06:31:07 +00:00
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include <QPointer>
|
2009-04-30 15:29:03 +00:00
|
|
|
|
|
|
|
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 );
|
|
|
|
|
2023-04-17 02:23:39 +00:00
|
|
|
~EditDictionaries() = default;
|
2014-06-24 13:55:06 +00:00
|
|
|
|
2010-05-08 14:01:59 +00:00
|
|
|
/// Instructs the dialog to position itself on editing the given group.
|
|
|
|
void editGroup( unsigned id );
|
|
|
|
|
2009-04-30 15:29:03 +00:00
|
|
|
/// 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 );
|
|
|
|
|
2011-06-13 12:30:49 +00:00
|
|
|
void buttonBoxClicked( QAbstractButton * button );
|
|
|
|
|
2009-05-05 08:57:37 +00:00
|
|
|
void rescanSources();
|
2011-05-29 05:08:37 +00:00
|
|
|
|
2013-07-07 08:09:46 +00:00
|
|
|
signals:
|
|
|
|
|
2012-12-20 13:25:03 +00:00
|
|
|
void showDictionaryInfo( QString const & dictId );
|
|
|
|
|
2023-04-12 19:52:35 +00:00
|
|
|
void showDictionaryHeadwords( Dictionary::Class * dict );
|
2014-03-01 13:11:14 +00:00
|
|
|
|
2009-04-30 15:29:03 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
bool isSourcesChanged() const;
|
|
|
|
|
2009-05-15 12:39:53 +00:00
|
|
|
void acceptChangedSources( bool rebuildGroups );
|
2011-06-13 12:30:49 +00:00
|
|
|
|
2022-05-19 13:04:31 +00:00
|
|
|
//the rebuildGroups was an initative,means to build the group if possible.
|
|
|
|
void save( bool rebuildGroups = false );
|
|
|
|
|
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;
|
2022-05-15 09:43:22 +00:00
|
|
|
QPointer<OrderAndProps> orderAndProps;
|
2009-04-30 15:29:03 +00:00
|
|
|
sptr< Groups > groups;
|
|
|
|
|
|
|
|
bool dictionariesChanged;
|
|
|
|
bool groupsChanged;
|
|
|
|
|
2014-06-24 13:55:06 +00:00
|
|
|
int lastCurrentTab;
|
|
|
|
|
|
|
|
QAction helpAction;
|
2009-04-30 15:29:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|