Cockatrice/cockatrice/src/window_sets.h
David Szabo 283ce23111 Manage sets window: "Enable all/selected" button toggling never disabled (#3337)
## Related Ticket(s)
- Fixes #3314 

## Short roundup of the initial problem
When the view was sorted in the manage sets window, the "Enable/Disable All" buttons never toggled to "Enable/Disable selected" buttons, even when more sets were selected.

## What will change with this Pull Request?
- Selected sets can be enabled/disabled in sorted view as well
2018-07-25 14:39:42 +02:00

70 lines
1.7 KiB
C++

#ifndef WINDOW_SETS_H
#define WINDOW_SETS_H
#include <QDialogButtonBox>
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QMainWindow>
#include <QSet>
class SetsModel;
class SetsProxyModel;
class SetsDisplayModel;
class QPushButton;
class CardDatabase;
class QItemSelection;
class QTreeView;
class WndSets : public QMainWindow
{
Q_OBJECT
private:
SetsModel *model;
SetsDisplayModel *displayModel;
QTreeView *view;
QPushButton *toggleAllButton, *toggleSelectedButton;
QPushButton *enableAllButton, *disableAllButton, *enableSomeButton, *disableSomeButton;
QPushButton *defaultSortButton;
QAction *aUp, *aDown, *aBottom, *aTop;
QToolBar *setsEditToolBar;
QDialogButtonBox *buttonBox;
QLabel *labNotes, *searchLabel, *sortWarning;
QLineEdit *searchField;
QGridLayout *mainLayout;
QHBoxLayout *filterBox;
int sortIndex;
Qt::SortOrder sortOrder;
void rebuildMainLayout(int actionToTake);
bool setOrderIsSorted;
enum
{
NO_SETS_SELECTED,
SOME_SETS_SELECTED
};
public:
WndSets(QWidget *parent = 0);
~WndSets();
protected:
void selectRows(QSet<int> rows);
private slots:
void actEnableAll();
void actDisableAll();
void actEnableSome();
void actDisableSome();
void actSave();
void actRestore();
void actUp();
void actDown();
void actTop();
void actBottom();
void actToggleButtons(const QItemSelection &selected, const QItemSelection &deselected);
void actDisableSortButtons(int index);
void actRestoreOriginalOrder();
void actDisableResetButton(const QString &filterText);
void actSort(int index);
};
#endif