summaryrefslogtreecommitdiff
path: root/src/mainwindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cc')
-rw-r--r--src/mainwindow.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 87088b2..9ea5285 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -121,6 +121,7 @@ MainWindow::~MainWindow()
{
info->log("MIaV is shutting down.");
+ delete img_history;
delete camera;
delete btn_cpr;
@@ -262,7 +263,11 @@ void MainWindow::createGui()
int w = (int)((float)BUTTON_WIDTH * unit);
int h = (int)(576.0f / (720.0f / ((float)BUTTON_WIDTH * unit)));
- for(int i = 0; i < NUM_HISTORY; i++) {
+ int window_height = config->readInt("pixel_height");
+ this->num_history = (window_height - ((int)unit * BUTTON_HEIGHT)) / h;
+ img_history = new (HistoryWidget*)[this->num_history];
+
+ for(unsigned int i = 0; i < num_history; i++) {
img_history[i] = new HistoryWidget(gb);
img_history[i]->set_image(img_dummy);
img_history[i]->setFixedSize(w, h);
@@ -390,7 +395,7 @@ void MainWindow::clear()
// History widgets
- for(int i = 0; i < NUM_HISTORY; i++) {
+ for(unsigned int i = 0; i < num_history; i++) {
img_history[i]->set_image(img_dummy);
}
@@ -518,7 +523,7 @@ void MainWindow::shoot_clicked()
camera->snapshot(screenshot.bits());
QImage *image;
- for(int cnt = (NUM_HISTORY-1); cnt > 0; cnt--) {
+ for(int cnt = (num_history-1); cnt > 0; cnt--) {
image = img_history[cnt-1]->get_image();
img_history[cnt]->set_image(image);
}