2009-04-03 19:30:25 +00:00
|
|
|
/*
|
2016-05-13 17:40:36 +00:00
|
|
|
Copyright 2006-2016 The QElectroTech Team
|
2009-04-03 19:30:25 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech 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 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef INTERACTIVE_MOVE_ELEMENTS_HANDLER_H
|
|
|
|
#define INTERACTIVE_MOVE_ELEMENTS_HANDLER_H
|
|
|
|
#include "basicmoveelementshandler.h"
|
|
|
|
class QDialog;
|
|
|
|
class QDialogButtonBox;
|
|
|
|
class QAbstractButton;
|
|
|
|
class QPushButton;
|
|
|
|
class QFileNameEdit;
|
|
|
|
class QHBoxLayout;
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QLabel;
|
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
This class implements the MoveElementsHandler Strategy class by asking
|
|
|
|
users how to handle the various expected problems through interactive
|
|
|
|
dialogs.
|
2009-04-03 19:30:25 +00:00
|
|
|
*/
|
|
|
|
class InteractiveMoveElementsHandler : public BasicMoveElementsHandler {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// constructors, destructor
|
2009-04-03 19:30:25 +00:00
|
|
|
public:
|
|
|
|
InteractiveMoveElementsHandler(QWidget * = 0);
|
|
|
|
virtual ~InteractiveMoveElementsHandler();
|
|
|
|
private:
|
|
|
|
InteractiveMoveElementsHandler(const InteractiveMoveElementsHandler &);
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods
|
2009-04-03 19:30:25 +00:00
|
|
|
public:
|
|
|
|
virtual QET::Action categoryAlreadyExists(ElementsCategory *, ElementsCategory *);
|
|
|
|
virtual QET::Action elementAlreadyExists(ElementDefinition *, ElementDefinition *);
|
|
|
|
virtual QET::Action categoryIsNotReadable(ElementsCategory *);
|
|
|
|
virtual QET::Action elementIsNotReadable(ElementDefinition *);
|
|
|
|
virtual QET::Action categoryIsNotWritable(ElementsCategory *);
|
|
|
|
virtual QET::Action elementIsNotWritable(ElementDefinition *);
|
|
|
|
virtual QET::Action errorWithACategory(ElementsCategory *, const QString &);
|
|
|
|
virtual QET::Action errorWithAnElement(ElementDefinition *, const QString &);
|
|
|
|
virtual QString nameForRenamingOperation();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void conflictDialogFileNameFieldChanged();
|
|
|
|
void conflictDialogButtonClicked(QAbstractButton *);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void initConflictDialog();
|
|
|
|
void setConflictDialogTitle(const QString &);
|
|
|
|
QString conflictDialogTitle() const;
|
|
|
|
void setConflictDialogMainWidget(QWidget *);
|
|
|
|
QWidget *conflictDialogMainWidget() const;
|
|
|
|
QET::Action retryErrorMessage(const QString &) const;
|
|
|
|
void simpleErrorMessage(const QString &) const;
|
|
|
|
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// attributes
|
2009-04-03 19:30:25 +00:00
|
|
|
private:
|
2012-11-09 21:09:24 +00:00
|
|
|
QWidget *parent_widget_; ///< Widget to be used as parent when displaying dialogs
|
|
|
|
QString rename_; ///< Name to be used when renaming an item
|
|
|
|
bool always_erase_; ///< Whether to systematically erase conflicting targets without bothering users
|
|
|
|
bool always_skip_; ///< Whether to systematically ignore conflicting targets without bothering users
|
|
|
|
bool aborted_; ///< Whether the movement has been cancelled
|
2009-04-03 19:30:25 +00:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// attributes related to the dialog displayed for already existing elements and
|
|
|
|
// categories (= i.e. conflict dialog)
|
2009-04-03 19:30:25 +00:00
|
|
|
QET::Action conflict_result_;
|
|
|
|
QDialog *conflict_dialog_;
|
|
|
|
QVBoxLayout *conflict_layout0_;
|
|
|
|
QHBoxLayout *conflict_layout1_;
|
|
|
|
QLabel *rename_label_;
|
|
|
|
QFileNameEdit *rename_textfield_;
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
/// Buttons for the conflict dialog
|
2009-04-03 19:30:25 +00:00
|
|
|
QDialogButtonBox *conflict_buttons_;
|
|
|
|
QPushButton *rename_button_;
|
|
|
|
QPushButton *erase_button_;
|
|
|
|
QPushButton *erase_all_button_;
|
|
|
|
QPushButton *ignore_button_;
|
|
|
|
QPushButton *ignore_all_button_;
|
|
|
|
QPushButton *abort_button_;
|
|
|
|
};
|
|
|
|
#endif
|