diff --git a/app/OpenBR/OpenBR.cpp b/app/OpenBR/OpenBR.cpp index 0f99670..20cbf7e 100644 --- a/app/OpenBR/OpenBR.cpp +++ b/app/OpenBR/OpenBR.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -20,12 +21,16 @@ public: : QMainWindow(parent) { QGridLayout *gridLayout = new QGridLayout(); + Algorithm *algorithm = new Algorithm(); + algorithm->addAlgorithm("FaceRecognition", "Face Recognition"); + algorithm->addAlgorithm("PP5", "PittPatt"); TemplateViewer *target = new TemplateViewer(); TemplateViewer *query = new TemplateViewer(); Tail *tail = new Tail(); - gridLayout->addWidget(query, 0, 0, 1, 1); - gridLayout->addWidget(target, 0, 1, 1, 1); - gridLayout->addWidget(tail, 1, 0, 1, 2); + gridLayout->addWidget(algorithm, 0, 0, 1, 2); + gridLayout->addWidget(query, 1, 0, 1, 1); + gridLayout->addWidget(target, 1, 1, 1, 1); + gridLayout->addWidget(tail, 2, 0, 1, 2); QMenuBar *menuBar = new QMenuBar(); QMenu *helpMenu = new QMenu("Help"); @@ -43,6 +48,11 @@ public: setWindowTitle("OpenBR"); setCentralWidget(new QWidget(this)); centralWidget()->setLayout(gridLayout); + + connect(target, SIGNAL(newInput(File)), tail, SLOT(setTargetGallery(File))); + connect(query, SIGNAL(newInput(File)), tail, SLOT(setQueryGallery(File))); + connect(tail, SIGNAL(newTargetFile(File)), target, SLOT(setFile(File))); + connect(tail, SIGNAL(newQueryFile(File)), query, SLOT(setFile(File))); } private slots: diff --git a/openbr/gui/algorithm.cpp b/openbr/gui/algorithm.cpp index 633122d..7d89c7d 100644 --- a/openbr/gui/algorithm.cpp +++ b/openbr/gui/algorithm.cpp @@ -6,10 +6,16 @@ /**** ALGORITHM ****/ /*** PUBLIC ***/ br::Algorithm::Algorithm(QWidget *parent) - : QComboBox(parent) + : QWidget(parent) { - setToolTip("Algorithm"); - connect(this, SIGNAL(currentIndexChanged(QString)), this, SLOT(setAlgorithm(QString))); + layout = new QHBoxLayout(this); + label = new QLabel("Algorithm:", this); + comboBox = new QComboBox(this); + comboBox->setToolTip("Algorithm"); + layout->addWidget(label); + layout->addWidget(comboBox, 1); + setLayout(layout); + connect(comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setAlgorithm(QString))); } /*** PUBLIC SLOTS ***/ @@ -23,10 +29,10 @@ bool br::Algorithm::addAlgorithm(const QString &algorithm, const QString &displa return false; if (displayName.isEmpty()) { - addItem(algorithm); + comboBox->addItem(algorithm); } else { displayNames.insert(displayName, algorithm); - addItem(displayName); + comboBox->addItem(displayName); } return true; } diff --git a/openbr/gui/algorithm.h b/openbr/gui/algorithm.h index d6bc2a4..6b838e5 100644 --- a/openbr/gui/algorithm.h +++ b/openbr/gui/algorithm.h @@ -1,7 +1,9 @@ #ifndef BR_ALGORITHM_H #define BR_ALGORITHM_H +#include #include +#include #include #include #include @@ -9,9 +11,12 @@ namespace br { -class BR_EXPORT Algorithm : public QComboBox +class BR_EXPORT Algorithm : public QWidget { Q_OBJECT + QHBoxLayout *layout; + QLabel *label; + QComboBox *comboBox; QHash displayNames; public: diff --git a/openbr/gui/tail.cpp b/openbr/gui/tail.cpp index 9b2a5c7..e9da86d 100644 --- a/openbr/gui/tail.cpp +++ b/openbr/gui/tail.cpp @@ -11,7 +11,7 @@ Tail::Tail(QWidget *parent) { count = 1; setOrientation(Qt::Horizontal); - setEnabled(false); + setVisible(false); } /*** PUBLIC SLOTS ***/ @@ -22,7 +22,9 @@ void Tail::setIndex(int index) if (index > scores.size() - count) index = std::max(0, scores.size() - count); setIndex(index); + emit newTargetFile(targets[index]); emit newTargetFiles(targets.mid(index, count)); + emit newQueryFile(queries[index]); emit newQueryFiles(queries.mid(index, count)); } @@ -128,7 +130,7 @@ void Tail::import(QString tailFile) } setMaximum(scores.size()-1); - setEnabled(scores.size() > 0); + setVisible(scores.size() > 0); setIndex(0); } diff --git a/openbr/gui/tail.h b/openbr/gui/tail.h index 397ed03..f8e00df 100644 --- a/openbr/gui/tail.h +++ b/openbr/gui/tail.h @@ -46,7 +46,9 @@ private slots: void selected(QPointF point); signals: + void newTargetFile(File file); void newTargetFiles(FileList files); + void newQueryFile(File file); void newQueryFiles(FileList files); };