rock_widget_collection  0.1
TestWidget.h
Go to the documentation of this file.
1 #ifndef TESTWIDGET_H
2 #define TESTWIDGET_H
3 
4 #include <QtGui>
5 #include "Timeline.h"
6 #include <iostream>
7 
8 class TestWidget : public QWidget {
9  Q_OBJECT
10 public slots:
12  int value = ledit->text().toInt();
13  tw->setSliderIndex(value);
15  }
16 
18  int value = ledit->text().toInt();
19  tw->setStartMarkerIndex(value);
21  }
22 
24  int value = ledit->text().toInt();
25  tw->setEndMarkerIndex(value);
27  }
28 
30  startMarkerIndex->setText(QString::number(tw->getStartMarkerIndex()));
31  endMarkerIndex->setText(QString::number(tw->getEndMarkerIndex()));
32  sliderIndex->setText(QString::number(tw->getSliderIndex()));
33  }
34 
36  tw->addBookmark(ledit->text().toInt());
37  }
38 
40  tw->removeBookmark(ledit->text().toInt());
41  }
42 
43 public:
45  this->tw = tw;
46 
47  connect(tw, SIGNAL(timeout()), this, SLOT(updateValueDisplay()));
48 
49  resize(300,300);
50 
51  QVBoxLayout vbox(this);
52  vbox.setAlignment(Qt::AlignTop);
53 
54  // Text entering field
55  ledit = new QLineEdit();
56 
57  butSetIndexSlider = new QPushButton("Set IndexSlider");
58  butSetStartMarker = new QPushButton("Set start marker index");
59  butSetEndMarker = new QPushButton("Set end marker index");
60  butAddBookmark = new QPushButton("Add bookmark");
61  butRemoveBookmark = new QPushButton("Remove bookmark");
62  butRemoveAllBookmarks = new QPushButton("Remove all bookmarks");
63 
64  vbox.addWidget(ledit);
65  vbox.addWidget(butSetIndexSlider);
66  vbox.addWidget(butSetStartMarker);
67  vbox.addWidget(butSetEndMarker);
68  vbox.addWidget(butAddBookmark);
69  vbox.addWidget(butRemoveBookmark);
70  vbox.addWidget(butRemoveAllBookmarks);
71 
72  QFormLayout formLayout(this);
73  vbox.addLayout(&formLayout);
74  formLayout.addRow("Start marker index:", startMarkerIndex = new QLabel("value"));
75  formLayout.addRow("End marker index:", endMarkerIndex = new QLabel("value"));
76  formLayout.addRow("Index slider index:", sliderIndex = new QLabel("value"));
77 
78  connect(butSetIndexSlider, SIGNAL(pressed()), this, SLOT(updateSliderIndex()));
79  connect(butSetStartMarker, SIGNAL(pressed()), this, SLOT(updateStartMarkerIndex()));
80  connect(butSetEndMarker, SIGNAL(pressed()), this, SLOT(updateEndMarkerIndex()));
81  connect(butAddBookmark, SIGNAL(pressed()), this, SLOT(addBookmarkRequest()));
82  connect(butRemoveBookmark, SIGNAL(pressed()), this, SLOT(removeBookmarkRequest()));
83  connect(butRemoveAllBookmarks, SIGNAL(pressed()), tw, SLOT(removeAllBookmarks()));
84 
86 
87  show();
88 
89  }
90 
91 
92 private:
93  Timeline *tw;
94  QLineEdit *ledit;
95  QPushButton *butSetIndexSlider;
96  QPushButton *butSetStartMarker;
97  QPushButton *butSetEndMarker;
98  QPushButton *butAddBookmark;
99  QPushButton *butRemoveBookmark;
100  QPushButton *butRemoveAllBookmarks;
101  QLabel *startMarkerIndex;
102  QLabel *endMarkerIndex;
103  QLabel *sliderIndex;
104 
105 };
106 
107 #endif /* TESTWIDGET_H */
108 
int getStartMarkerIndex()
Definition: Timeline.cc:140
void removeBookmarkRequest()
Definition: TestWidget.h:39
void removeBookmark(int idx)
Definition: Timeline.cc:185
void setStartMarkerIndex(int idx)
Definition: Timeline.cc:144
void updateEndMarkerIndex()
Definition: TestWidget.h:23
void setSliderIndex(int idx)
Definition: Timeline.cc:157
int getSliderIndex()
Definition: Timeline.cc:136
void updateSliderIndex()
Definition: TestWidget.h:11
void setEndMarkerIndex(int idx)
Definition: Timeline.cc:153
TestWidget(Timeline *tw)
Definition: TestWidget.h:44
void updateValueDisplay()
Definition: TestWidget.h:29
int getEndMarkerIndex()
Definition: Timeline.cc:149
void addBookmarkRequest()
Definition: TestWidget.h:35
void updateStartMarkerIndex()
Definition: TestWidget.h:17
void addBookmark(int idx)
Definition: Timeline.cc:168