2010-04-01 01:11:45 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-04-01 01:11:45 +02:00
|
|
|
|
|
|
|
Clementine 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.
|
|
|
|
|
|
|
|
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GROUPBYDIALOG_H
|
|
|
|
#define GROUPBYDIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
|
|
|
#include <boost/multi_index_container.hpp>
|
|
|
|
#include <boost/multi_index/member.hpp>
|
|
|
|
#include <boost/multi_index/ordered_index.hpp>
|
|
|
|
|
2010-05-09 02:10:26 +02:00
|
|
|
#include "librarymodel.h"
|
2010-05-10 23:50:31 +02:00
|
|
|
|
|
|
|
class Ui_GroupByDialog;
|
2010-04-01 01:11:45 +02:00
|
|
|
|
|
|
|
using boost::multi_index_container;
|
|
|
|
using boost::multi_index::indexed_by;
|
|
|
|
using boost::multi_index::ordered_unique;
|
|
|
|
using boost::multi_index::tag;
|
|
|
|
using boost::multi_index::member;
|
|
|
|
|
|
|
|
class GroupByDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
GroupByDialog(QWidget *parent = 0);
|
2010-05-10 23:50:31 +02:00
|
|
|
~GroupByDialog();
|
2010-04-01 01:11:45 +02:00
|
|
|
|
|
|
|
public slots:
|
2010-05-09 02:10:26 +02:00
|
|
|
void LibraryGroupingChanged(const LibraryModel::Grouping& g);
|
2010-04-01 01:11:45 +02:00
|
|
|
void accept();
|
|
|
|
|
|
|
|
signals:
|
2010-05-09 02:10:26 +02:00
|
|
|
void Accepted(const LibraryModel::Grouping& g);
|
2010-04-01 01:11:45 +02:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void Reset();
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct Mapping {
|
2010-05-09 02:10:26 +02:00
|
|
|
Mapping(LibraryModel::GroupBy g, int i) : group_by(g), combo_box_index(i) {}
|
2010-04-01 01:11:45 +02:00
|
|
|
|
2010-05-09 02:10:26 +02:00
|
|
|
LibraryModel::GroupBy group_by;
|
2010-04-01 01:11:45 +02:00
|
|
|
int combo_box_index;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tag_index {};
|
|
|
|
struct tag_group_by {};
|
|
|
|
typedef multi_index_container<
|
|
|
|
Mapping,
|
|
|
|
indexed_by<
|
|
|
|
ordered_unique<tag<tag_index>,
|
|
|
|
member<Mapping, int, &Mapping::combo_box_index> >,
|
|
|
|
ordered_unique<tag<tag_group_by>,
|
2010-05-09 02:10:26 +02:00
|
|
|
member<Mapping, LibraryModel::GroupBy, &Mapping::group_by> >
|
2010-04-01 01:11:45 +02:00
|
|
|
>
|
|
|
|
> MappingContainer;
|
|
|
|
|
|
|
|
MappingContainer mapping_;
|
2010-05-10 23:50:31 +02:00
|
|
|
Ui_GroupByDialog* ui_;
|
2010-04-01 01:11:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GROUPBYDIALOG_H
|