-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplaylistcomparator.h
60 lines (49 loc) · 1.73 KB
/
playlistcomparator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* Declaration of the PlaylistComparator class, used to compare audios in the @see PlaylistTableView.
*/
#ifndef PLAYLISTCOMPARATOR_H
#define PLAYLISTCOMPARATOR_H
#include <QString>
#include "model/header/audiomedia.h"
class PlaylistComparator
{
public:
/**
* Constructs a PlaylistSorter object.
*
* @param column Column in a @see PlaylistTableModel.
* @param order Order to sort.
*/
PlaylistComparator(const int column, const Qt::SortOrder order);
/**
* Overrides the operator () to pass additional parameters to the comparator.
*
* @param audio1 First audio to compare.
* @param audio2 Second audio to compare to.
* @return Returns true or false, depending on the {@link #order}.
*/
bool operator()(const AudioMedia &audio1, const AudioMedia &audio2) const;
/**
* Compares two audios.
*
* @param audio1 First audio to compare.
* @param audio2 Second audio to compare to.
* @param column Column in a @see PlaylistTableModel.
* @param order Order to sort.
* @return If the order is ascending, returns true if the attribute of the first audio in the column is
* greater than the attribute of the second audio in the column.
* If the order is descending, returns true if the attribute of the first audio in the column is
* less than the attribute of the second audio in the column.
*/
bool compareAudios(const AudioMedia &audio1, const AudioMedia &audio2, const int column, const Qt::SortOrder order) const;
private:
/**
* Column of a @see PlaylistTableModel.
*/
const int column;
/**
* Sort order @see Qt::SortOrder.
*/
const Qt::SortOrder order;
};
#endif // PLAYLISTCOMPARATOR_H