-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathPluginInfoWidget.cpp
74 lines (61 loc) · 2.56 KB
/
PluginInfoWidget.cpp
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
//-----------------------------------------------------------------------------
// File: PluginInfoWidget.cpp
//-----------------------------------------------------------------------------
// Project: Kactus 2
// Author: Esko Pekkarinen
// Date: 13.1.2014
//
// Description:
// Widget for displaying plugin information.
//-----------------------------------------------------------------------------
#include "PluginInfoWidget.h"
#include <QFormLayout>
#include <QLabel>
#include <QGridLayout>
#include <QGroupBox>
//-----------------------------------------------------------------------------
// Function: PluginInfoWidget::PluginInfoWidget()
//-----------------------------------------------------------------------------
PluginInfoWidget::PluginInfoWidget(IPlugin* plugin, QWidget *parent) :
QWidget(parent),
plugin_(plugin)
{
setupLayout();
}
//-----------------------------------------------------------------------------
// Function: PluginInfoWidget::setupLayout()
//-----------------------------------------------------------------------------
void PluginInfoWidget::setupLayout()
{
auto masterLayout(new QVBoxLayout(this));
if (plugin_)
{
auto topLayout(new QFormLayout());
topLayout->addRow(tr("Name:"), new QLabel(plugin_->getName(), this));
topLayout->addRow(tr("Version:"), new QLabel(plugin_->getVersion(), this));
topLayout->addRow(tr("Vendor:"), new QLabel(plugin_->getVendor(), this));
topLayout->addRow(tr("Licensed to:"), new QLabel(plugin_->getLicenseHolder(), this));
topLayout->addRow(tr("License:"), new QLabel(plugin_->getLicense(), this));
QLabel* descriptionLabel = new QLabel(plugin_->getDescription(), this);
descriptionLabel->setWordWrap(true);
topLayout->addRow(tr("Description:"), descriptionLabel);
masterLayout->addLayout(topLayout);
QWidget* settingsWidget = plugin_->getSettingsWidget();
if (settingsWidget)
{
settingsWidget->setParent(this);
settingsWidget->setContentsMargins(0, 0, 0, 0);
auto groupLayout(new QVBoxLayout());
groupLayout->addWidget(settingsWidget);
auto settingsGroup(new QGroupBox("Settings", this));
settingsGroup->setLayout(groupLayout);
groupLayout->setContentsMargins(0, 0, 0, 0);
settingsGroup->setContentsMargins(0, 0, 0, 0);
masterLayout->addWidget(settingsGroup, 2);
}
else
{
masterLayout->addStretch(2);
}
}
}