Commit 4f0069244d9ba9a2085eebf05bfba57822e60767
1 parent
592c113f
gui progress
Showing
5 changed files
with
36 additions
and
11 deletions
app/OpenBR/OpenBR.cpp
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | #include <QMenuBar> |
| 7 | 7 | #include <QMessageBox> |
| 8 | 8 | #include <openbr/openbr_plugin.h> |
| 9 | +#include <openbr/gui/algorithm.h> | |
| 9 | 10 | #include <openbr/gui/tail.h> |
| 10 | 11 | #include <openbr/gui/templateviewer.h> |
| 11 | 12 | |
| ... | ... | @@ -20,12 +21,16 @@ public: |
| 20 | 21 | : QMainWindow(parent) |
| 21 | 22 | { |
| 22 | 23 | QGridLayout *gridLayout = new QGridLayout(); |
| 24 | + Algorithm *algorithm = new Algorithm(); | |
| 25 | + algorithm->addAlgorithm("FaceRecognition", "Face Recognition"); | |
| 26 | + algorithm->addAlgorithm("PP5", "PittPatt"); | |
| 23 | 27 | TemplateViewer *target = new TemplateViewer(); |
| 24 | 28 | TemplateViewer *query = new TemplateViewer(); |
| 25 | 29 | Tail *tail = new Tail(); |
| 26 | - gridLayout->addWidget(query, 0, 0, 1, 1); | |
| 27 | - gridLayout->addWidget(target, 0, 1, 1, 1); | |
| 28 | - gridLayout->addWidget(tail, 1, 0, 1, 2); | |
| 30 | + gridLayout->addWidget(algorithm, 0, 0, 1, 2); | |
| 31 | + gridLayout->addWidget(query, 1, 0, 1, 1); | |
| 32 | + gridLayout->addWidget(target, 1, 1, 1, 1); | |
| 33 | + gridLayout->addWidget(tail, 2, 0, 1, 2); | |
| 29 | 34 | |
| 30 | 35 | QMenuBar *menuBar = new QMenuBar(); |
| 31 | 36 | QMenu *helpMenu = new QMenu("Help"); |
| ... | ... | @@ -43,6 +48,11 @@ public: |
| 43 | 48 | setWindowTitle("OpenBR"); |
| 44 | 49 | setCentralWidget(new QWidget(this)); |
| 45 | 50 | centralWidget()->setLayout(gridLayout); |
| 51 | + | |
| 52 | + connect(target, SIGNAL(newInput(File)), tail, SLOT(setTargetGallery(File))); | |
| 53 | + connect(query, SIGNAL(newInput(File)), tail, SLOT(setQueryGallery(File))); | |
| 54 | + connect(tail, SIGNAL(newTargetFile(File)), target, SLOT(setFile(File))); | |
| 55 | + connect(tail, SIGNAL(newQueryFile(File)), query, SLOT(setFile(File))); | |
| 46 | 56 | } |
| 47 | 57 | |
| 48 | 58 | private slots: | ... | ... |
openbr/gui/algorithm.cpp
| ... | ... | @@ -6,10 +6,16 @@ |
| 6 | 6 | /**** ALGORITHM ****/ |
| 7 | 7 | /*** PUBLIC ***/ |
| 8 | 8 | br::Algorithm::Algorithm(QWidget *parent) |
| 9 | - : QComboBox(parent) | |
| 9 | + : QWidget(parent) | |
| 10 | 10 | { |
| 11 | - setToolTip("Algorithm"); | |
| 12 | - connect(this, SIGNAL(currentIndexChanged(QString)), this, SLOT(setAlgorithm(QString))); | |
| 11 | + layout = new QHBoxLayout(this); | |
| 12 | + label = new QLabel("Algorithm:", this); | |
| 13 | + comboBox = new QComboBox(this); | |
| 14 | + comboBox->setToolTip("Algorithm"); | |
| 15 | + layout->addWidget(label); | |
| 16 | + layout->addWidget(comboBox, 1); | |
| 17 | + setLayout(layout); | |
| 18 | + connect(comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setAlgorithm(QString))); | |
| 13 | 19 | } |
| 14 | 20 | |
| 15 | 21 | /*** PUBLIC SLOTS ***/ |
| ... | ... | @@ -23,10 +29,10 @@ bool br::Algorithm::addAlgorithm(const QString &algorithm, const QString &displa |
| 23 | 29 | return false; |
| 24 | 30 | |
| 25 | 31 | if (displayName.isEmpty()) { |
| 26 | - addItem(algorithm); | |
| 32 | + comboBox->addItem(algorithm); | |
| 27 | 33 | } else { |
| 28 | 34 | displayNames.insert(displayName, algorithm); |
| 29 | - addItem(displayName); | |
| 35 | + comboBox->addItem(displayName); | |
| 30 | 36 | } |
| 31 | 37 | return true; |
| 32 | 38 | } | ... | ... |
openbr/gui/algorithm.h
| 1 | 1 | #ifndef BR_ALGORITHM_H |
| 2 | 2 | #define BR_ALGORITHM_H |
| 3 | 3 | |
| 4 | +#include <QBoxLayout> | |
| 4 | 5 | #include <QComboBox> |
| 6 | +#include <QLabel> | |
| 5 | 7 | #include <QString> |
| 6 | 8 | #include <QWidget> |
| 7 | 9 | #include <openbr/openbr_export.h> |
| ... | ... | @@ -9,9 +11,12 @@ |
| 9 | 11 | namespace br |
| 10 | 12 | { |
| 11 | 13 | |
| 12 | -class BR_EXPORT Algorithm : public QComboBox | |
| 14 | +class BR_EXPORT Algorithm : public QWidget | |
| 13 | 15 | { |
| 14 | 16 | Q_OBJECT |
| 17 | + QHBoxLayout *layout; | |
| 18 | + QLabel *label; | |
| 19 | + QComboBox *comboBox; | |
| 15 | 20 | QHash<QString, QString> displayNames; |
| 16 | 21 | |
| 17 | 22 | public: | ... | ... |
openbr/gui/tail.cpp
| ... | ... | @@ -11,7 +11,7 @@ Tail::Tail(QWidget *parent) |
| 11 | 11 | { |
| 12 | 12 | count = 1; |
| 13 | 13 | setOrientation(Qt::Horizontal); |
| 14 | - setEnabled(false); | |
| 14 | + setVisible(false); | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /*** PUBLIC SLOTS ***/ |
| ... | ... | @@ -22,7 +22,9 @@ void Tail::setIndex(int index) |
| 22 | 22 | if (index > scores.size() - count) index = std::max(0, scores.size() - count); |
| 23 | 23 | setIndex(index); |
| 24 | 24 | |
| 25 | + emit newTargetFile(targets[index]); | |
| 25 | 26 | emit newTargetFiles(targets.mid(index, count)); |
| 27 | + emit newQueryFile(queries[index]); | |
| 26 | 28 | emit newQueryFiles(queries.mid(index, count)); |
| 27 | 29 | } |
| 28 | 30 | |
| ... | ... | @@ -128,7 +130,7 @@ void Tail::import(QString tailFile) |
| 128 | 130 | } |
| 129 | 131 | |
| 130 | 132 | setMaximum(scores.size()-1); |
| 131 | - setEnabled(scores.size() > 0); | |
| 133 | + setVisible(scores.size() > 0); | |
| 132 | 134 | setIndex(0); |
| 133 | 135 | } |
| 134 | 136 | ... | ... |
openbr/gui/tail.h