summaryrefslogblamecommitdiffstats
path: root/src/sessiontreeitem.h
blob: 6202b620251eae29356a9971067acd1975874623 (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 = 0);
    SessionTreeItem(const SectionType type, SessionTreeItem *parent = 0);
    SessionTreeItem(const QString& text, SessionTreeItem *parent = 0);
    ~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