Commit f1c8124731a91bde825053eb1a354514a2231ba4

Authored by Scott Klum
1 parent 76f03428

Added proper files to source control, solves #238

openbr/gui/formcombowidget.h
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 #include <QStringList> 6 #include <QStringList>
7 #include <QComboBox> 7 #include <QComboBox>
8 8
9 -#include <openbr/openbr_plugin.h> 9 +#include <openbr/openbr_export.h>
10 10
11 namespace br { 11 namespace br {
12 12
openbr/gui/metadata.cpp 0 โ†’ 100644
  1 +#include "metadata.h"
  2 +
  3 +using namespace br;
  4 +
  5 +Metadata::Metadata(QWidget *parent) :
  6 + QWidget(parent)
  7 +{
  8 + name = new QLabel("Name: ");
  9 + gender = new QLabel("Gender: ");
  10 + age = new QLabel("Age: ");
  11 + race = new QLabel("Race: ");
  12 + height = new QLabel("Height: ");
  13 + weight = new QLabel("Weight: ");
  14 +
  15 + layout.addWidget(name);
  16 + layout.addWidget(gender);
  17 + layout.addWidget(age);
  18 + layout.addWidget(race);
  19 + layout.addWidget(height);
  20 + layout.addWidget(weight);
  21 +
  22 + setLayout(&layout);
  23 +}
  24 +
  25 +void Metadata::reset()
  26 +{
  27 + name->setText("Name: ");
  28 + gender->setText("Gender: ");
  29 + age->setText("Age: ");
  30 + race->setText("Race: ");
  31 + height->setText("Height: ");
  32 + weight->setText("Weight: ");
  33 +}
  34 +
  35 +void Metadata::setMetadata(br::File file)
  36 +{
  37 + if (file.isNull()) {
  38 + reset();
  39 + }
  40 + else {
  41 + name->setText(file.get<QString>("LASTNAME", "N/A") + ", " + file.get<QString>("FIRSTNAME", "N/A"));
  42 + gender->setText("Gender: " + file.get<QString>("GENDER", "N/A"));
  43 + age->setText("Age: " + file.get<QString>("Age", "N/A"));
  44 + race->setText("Race: " + file.get<QString>("RACE", "N/A"));
  45 + height->setText("Height: " + file.get<QString>("HEIGHT", "N/A"));
  46 + weight->setText("Weight: " + file.get<QString>("WEIGHT", "N/A"));
  47 + }
  48 +}
openbr/gui/metadata.h 0 โ†’ 100755
  1 +#ifndef BR_METADATA_H
  2 +#define BR_METADATA_H
  3 +
  4 +#include <QToolBar>
  5 +#include <QHBoxLayout>
  6 +#include <QLabel>
  7 +#include <QGroupBox>
  8 +
  9 +#include <openbr/openbr_plugin.h>
  10 +
  11 +namespace br {
  12 +
  13 +class BR_EXPORT Metadata : public QWidget
  14 +{
  15 + Q_OBJECT
  16 +
  17 + QVBoxLayout layout;
  18 +
  19 + QLabel *name;
  20 + QLabel *gender;
  21 + QLabel *race;
  22 + QLabel *age;
  23 + QLabel *weight;
  24 + QLabel *height;
  25 +
  26 +public:
  27 + explicit Metadata(QWidget *parent = 0);
  28 +
  29 +signals:
  30 +
  31 +public slots:
  32 + void reset();
  33 + void setMetadata(br::File);
  34 +
  35 +};
  36 +
  37 +}
  38 +
  39 +#endif // BR_METADATA_H
openbr/gui/pageflipwidget.h
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 #include <QPushButton> 5 #include <QPushButton>
6 #include <QHBoxLayout> 6 #include <QHBoxLayout>
7 7
8 -#include <openbr/openbr_plugin.h> 8 +#include <openbr/openbr_export.h>
9 9
10 namespace br { 10 namespace br {
11 11
openbr/gui/rangewidget.h
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 #include <QLabel> 8 #include <QLabel>
9 #include <QSpinBox> 9 #include <QSpinBox>
10 10
11 -#include <openbr/openbr_plugin.h> 11 +#include <openbr/openbr_export.h>
12 12
13 namespace br { 13 namespace br {
14 14
openbr/gui/recognitionbar.h
@@ -10,11 +10,11 @@ @@ -10,11 +10,11 @@
10 #include <QToolButton> 10 #include <QToolButton>
11 #include <QCheckBox> 11 #include <QCheckBox>
12 12
13 -#include "formcombowidget.h"  
14 -#include "rangewidget.h"  
15 -#include "pageflipwidget.h"  
16 -#include "searchboxwidget.h"  
17 -#include "metadata.h" 13 +#include <openbr/gui/formcombowidget.h>
  14 +#include <openbr/gui/rangewidget.h>
  15 +#include <openbr/gui/pageflipwidget.h>
  16 +#include <openbr/gui/searchboxwidget.h>
  17 +#include <openbr/gui/metadata.h>
18 18
19 #include <openbr/openbr_plugin.h> 19 #include <openbr/openbr_plugin.h>
20 20
openbr/gui/searchboxwidget.cpp 0 โ†’ 100644
  1 +#include "searchboxwidget.h"
  2 +
  3 +using namespace br;
  4 +
  5 +SearchBoxWidget::SearchBoxWidget(QWidget *parent) :
  6 + QWidget(parent)
  7 +{
  8 + model = new QStringListModel(this);
  9 + completer = new QCompleter(this);
  10 + completer->setCaseSensitivity(Qt::CaseInsensitive);
  11 + searchBar = new QLineEdit(this);
  12 +
  13 + layout = new QVBoxLayout(this);
  14 + layout->addWidget(searchBar);
  15 +
  16 + setLayout(layout);
  17 +
  18 + startIndex = 0;
  19 +
  20 + connect(searchBar, SIGNAL(returnPressed()), this, SLOT(setIndex()));
  21 +}
  22 +
  23 +void SearchBoxWidget::setFiles(br::FileList files)
  24 +{
  25 + words.clear();
  26 +
  27 + foreach (const br::File file, files)
  28 + words.push_back(file.get<QString>("LASTNAME","N/A") + ", " + file.get<QString>("FIRSTNAME", "N/A"));
  29 +
  30 + model->setStringList(words);
  31 + completer->setModel(model);
  32 +
  33 + searchBar->setCompleter(completer);
  34 +}
  35 +
  36 +void SearchBoxWidget::setIndex()
  37 +{
  38 + if (searchBar->text().isEmpty()) return;
  39 +
  40 + // Get index of currently selected object, starting at the previous searches index
  41 + int index = words.indexOf(searchBar->text(), startIndex);
  42 +
  43 + // Start from beginning of list if nothing is found
  44 + if (index == -1) {
  45 + index = words.indexOf(searchBar->text(), 0);
  46 + startIndex = index+1;
  47 + }
  48 + else startIndex = index+1;
  49 +
  50 + if (index != -1) emit newIndex(index);
  51 +}
openbr/gui/searchboxwidget.h 0 โ†’ 100644
  1 +#ifndef BR_SEARCHBOXWIDGET_H
  2 +#define BR_SEARCHBOXWIDGET_H
  3 +
  4 +#include <QWidget>
  5 +#include <QLineEdit>
  6 +#include <QCompleter>
  7 +#include <QVBoxLayout>
  8 +#include <QStringListModel>
  9 +
  10 +#include <openbr/openbr_plugin.h>
  11 +
  12 +namespace br {
  13 +
  14 +class BR_EXPORT SearchBoxWidget : public QWidget
  15 +{
  16 + Q_OBJECT
  17 +
  18 + QLineEdit *searchBar;
  19 + QCompleter *completer;
  20 + QStringListModel *model;
  21 + QVBoxLayout *layout;
  22 +
  23 + QStringList words;
  24 + int startIndex;
  25 +
  26 +public:
  27 + explicit SearchBoxWidget(QWidget *parent = 0);
  28 +
  29 +signals:
  30 +
  31 + void newIndex(int);
  32 +
  33 +public slots:
  34 +
  35 + void setFiles(br::FileList files);
  36 + void setIndex();
  37 +};
  38 +
  39 +}
  40 +
  41 +#endif // BR_SEARCHBOXWIDGET_H