summaryrefslogblamecommitdiffstats
path: root/src/sessiontreeitem.h
blob: 7c1a58f9854a236a14af363691fca036fb36744a (plain) (tree)
1
2
3
4
5
6
7
8





                         
                    
                    



                       


                                                                               


                                             
                                             


                                    
                                         

                              


                                                            




                                      
                                   
                        

                                                      


                           
#ifndef SESSIONTREEITEM_H
#define SESSIONTREEITEM_H

#include <QList>
#include <QVariant>

#include "session.h"
#include "globals.h"
#include <QString>

class SessionTreeItem {
  public:
    SessionTreeItem(const Session* session, SessionTreeItem *parent = nullptr);
    SessionTreeItem(const SectionType type, SessionTreeItem *parent = nullptr);
    SessionTreeItem(const QString& text, SessionTreeItem *parent = nullptr);
    ~SessionTreeItem();

    void appendChild(SessionTreeItem *child);
    void removeChild(SessionTreeItem *child);

    SessionTreeItem *child(int row);
    int childCount() const;
    int columnCount() const { return 1; }
    int row() const;
    SessionTreeItem *parent();
    const Session* session() const { return session_; }
    const QString text() const { return text_; }
    SectionType sectionType() const { return sectionType_; }

  private:
    QList<SessionTreeItem*> children_;
    SessionTreeItem *parent_;
    const Session *session_;
    const SectionType sectionType_;
    const QString text_;

    static QString typeToName(const SectionType type);
};

#endif // SESSIONTREEITEM_H