From d0c0145b6a6f60955fadf832bd55a4c403d83d6d Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Wed, 1 Apr 2015 10:26:53 +0200 Subject: [PATCH] Add statusbar etc. --- src/main.ui | 312 ++++++++++++++++++++++++--------------------- src/mainwindow.cpp | 20 ++- src/mainwindow.h | 2 +- src/src.pro | 2 +- 4 files changed, 187 insertions(+), 149 deletions(-) diff --git a/src/main.ui b/src/main.ui index 601eff6..b178f46 100644 --- a/src/main.ui +++ b/src/main.ui @@ -1,7 +1,8 @@ - + + MainWin - - + + 0 0 @@ -9,163 +10,190 @@ 352 - + TekPic - - + + + 6 + + 9 - - 6 + + 9 + + + 9 + + + 9 - - - 0 - - - 6 - + - - - - 5 - 5 - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + + + + 24 + + + Qt::Horizontal + + + + - - - 24 - - - Qt::Horizontal - - + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + &File name prefix: + + + prefixLine + + + + + + + + 0 + 0 + + + + osc- + + + + + + + Full file &name: + + + fileLine + + + + + + + + 0 + 0 + + + + + + + + Qt::Vertical + + + + 100 + 71 + + + + + + + + + 0 + 0 + + + + &Save + + + + + + + + 0 + 0 + + + + &Quit + + + + - - - 0 + + + QFrame::NoFrame - - 6 + + QFrame::Sunken - - - - &File name prefix: - - - prefixLine - - - - - - - - 0 - 0 - 0 - 0 - - - - osc- - - - - - - - Full file &name: - - - fileLine - - - - - - - - 0 - 0 - 0 - 0 - - - - - - - - Qt::Vertical - - - - 100 - 71 - - - - - - - - - 0 - 0 - 0 - 0 - - - - &Save - - - - - - - - 0 - 0 - 0 - 0 - - - - &Quit - - - - + + TextLabel + + - - - QScrollArea - QFrame -
QScrollArea
-
-
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fcde8f8..69c9f4a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -34,6 +34,8 @@ MainWindow::MainWindow(const string &tty) ui.progressBar->setValue(0); ui.progressBar->hide(); ui.saveButton->setDisabled(true); + + ui.statusBar->setText("Press \"hardcopy\" button on the scope..."); connect(ui.quitButton, SIGNAL(clicked()), this, SLOT(close())); connect(&m_commThread, SIGNAL(bytesReceived(int)), ui.progressBar, SLOT(setValue(int))); @@ -46,6 +48,7 @@ MainWindow::MainWindow(const string &tty) } + MainWindow::~MainWindow() { } @@ -59,18 +62,23 @@ void MainWindow::processImage( OscImage * img ) ui.progressBar->setValue(m_lastSize); ui.progressBar->hide(); - m_fileNum++; - generateFileName( ui.prefixLine->text()); - if (m_image) delete m_image; m_image = img; QPixmap pixmap; ret = pixmap.loadFromData(*m_image); - if (!ret) cerr << "Can't display image!"<setText("Cannot display the image! Unsupported format?"); + else + ui.statusBar->setText("Ready"); + QApplication::clipboard()->setPixmap(pixmap); imageLabel->setPixmap(pixmap); imageLabel->adjustSize(); + + m_fileNum++; + generateFileName( ui.prefixLine->text()); + } @@ -87,7 +95,8 @@ void MainWindow::generateFileName( const QString & prefix ) ts.setFieldWidth(3); ts.setPadChar('0') ; - ts << prefix << m_fileNum << ".tif"; + + ts << prefix << m_fileNum << ".bmp"; ui.fileLine->setText(fname); } @@ -104,6 +113,7 @@ void MainWindow::saveImage() void MainWindow::newImage() { ui.progressBar->show(); + ui.statusBar->setText("Transferring..."); if (m_lastSize == 0) ui.progressBar->setMaximum(0); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 74f37f9..417bbfb 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -38,7 +38,7 @@ public: ~MainWindow(); private: - Ui::MainWin ui; + Ui_MainWin ui; OscCommThread m_commThread; int m_fileNum; int m_lastSize; diff --git a/src/src.pro b/src/src.pro index a5c7033..0ece1bf 100644 --- a/src/src.pro +++ b/src/src.pro @@ -7,7 +7,7 @@ TARGET = ../bin/tekpic CONFIG += debug \ warn_on TEMPLATE = app -FORMS += main.ui +FORMS += main.ui HEADERS += mainwindow.h \ serial.h \ osccommthread.h -- 2.39.2