image_call_tab.cpp 1.48 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
#include <QString>
#include <QPushButton>

#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLabel>

#include "image_call_tab.hpp"
#include "../view/image_view.hpp"
#include "../controller/view_controller.hpp"
#include "../impl/single_image_call.hpp"
#include "../qtutil/util.hpp"


namespace cvv
{
namespace gui
{

ImageCallTab::ImageCallTab(const cvv::impl::SingleImageCall &call)
    : imageCall_{ call }
{
	setName(imageCall_->description());

	createGui();
}

ImageCallTab::ImageCallTab(const QString &tabName,
                           const cvv::impl::SingleImageCall &call)
    : imageCall_{ call }
{
	setName(tabName);

	createGui();
}

void ImageCallTab::helpButtonClicked() const
{
	cvv::qtutil::openHelpBrowser("SingleImageView");
}

size_t ImageCallTab::getId() const
{
	return imageCall_->getId();
}

void ImageCallTab::createGui()
{
	hlayout_ = new QHBoxLayout{ this };
	hlayout_->setAlignment(Qt::AlignTop);
	hlayout_->addWidget(new QLabel{ "Single Image View" });
	helpButton_ = new QPushButton{ "Help", this };
	hlayout_->addWidget(helpButton_);
	connect(helpButton_, SIGNAL(clicked()), this,
	        SLOT(helpButtonClicked()));

	upperBar_ = new QWidget{ this };
	upperBar_->setLayout(hlayout_);

	vlayout_ = new QVBoxLayout{ this };

	vlayout_->addWidget(upperBar_);
	setView();

	setLayout(vlayout_);
	imageView_->showFullImage();
}

void ImageCallTab::setView()
{
	imageView_ = new cvv::view::ImageView{ imageCall_->mat(), this };
	vlayout_->addWidget(imageView_);
}
}
} // namespaces