]> git.sesse.net Git - nageru/commitdiff
Make an enum for the view columns.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 11 Jun 2018 20:47:49 +0000 (22:47 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 11 Jun 2018 20:47:49 +0000 (22:47 +0200)
clip_list.cpp
clip_list.h

index d8eada85d5eab338751738c2a863b1a7d7f84a5a..2599dcc2d246cbbeceabd00ba48d940192cd1b0f 100644 (file)
@@ -15,7 +15,7 @@ int ClipList::rowCount(const QModelIndex &parent) const {
 
 int ClipList::columnCount(const QModelIndex &parent) const {
        if (parent.isValid()) return 0;
-       return 7;
+       return Column::NUM_COLUMNS;
 }
 
 QVariant ClipList::data(const QModelIndex &parent, int role) const {
@@ -55,19 +55,19 @@ QVariant ClipList::headerData(int section, Qt::Orientation orientation, int role
                return QVariant();
 
        switch (section) {
-       case 0:
+       case Column::IN:
                return "In";
-       case 1:
+       case Column::OUT:
                return "Out";
-       case 2:
+       case Column::DURATION:
                return "Duration";
-       case 3:
+       case Column::CAMERA_1:
                return "Camera 1";
-       case 4:
+       case Column::CAMERA_2:
                return "Camera 2";
-       case 5:
+       case Column::CAMERA_3:
                return "Camera 3";
-       case 6:
+       case Column::CAMERA_4:
                return "Camera 4";
        default:
                return "";
index da76f8c5b394f32bde6bcdf6727da5a02ff91f89..1cdbf355d7db0410883eb32137d519d9db8d8cfb 100644 (file)
@@ -17,6 +17,17 @@ class ClipList : public QAbstractTableModel {
        Q_OBJECT
 
 public:
+       enum Column {
+               IN,
+               OUT,
+               DURATION,
+               CAMERA_1,
+               CAMERA_2,
+               CAMERA_3,
+               CAMERA_4,
+               NUM_COLUMNS
+       };
+
        int rowCount(const QModelIndex &parent) const override;
        int columnCount(const QModelIndex &parent) const override;
        QVariant data(const QModelIndex &parent, int role) const override;