diff options
5 files changed, 65 insertions, 194 deletions
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.cpp index 2ab00a54f1..cf3412688f 100644 --- a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.cpp +++ b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.cpp @@ -24,9 +24,7 @@ ****************************************************************************/ #include "createandroidmanifestwizard.h" -#include "qmakeandroidbuildapkstep.h" #include "qmakeandroidbuildapkwidget.h" -#include "ui_qmakeandroidbuildapkwidget.h" #include <android/androidbuildapkwidget.h> #include <android/androidmanager.h> @@ -36,69 +34,81 @@ #include <utils/utilsicons.h> #include <QFileDialog> +#include <QGroupBox> #include <QLabel> +#include <QListView> +#include <QPushButton> +#include <QToolButton> +#include <QVBoxLayout> namespace QmakeAndroidSupport { namespace Internal { QmakeAndroidBuildApkWidget::QmakeAndroidBuildApkWidget(Android::AndroidBuildApkStep *step) : - m_ui(new Ui::QmakeAndroidBuildApkWidget), m_step(step) { - QVBoxLayout *topLayout = new QVBoxLayout; - - QHBoxLayout *qt51WarningLayout = new QHBoxLayout(); - QLabel *oldFilesWarningIcon = new QLabel(this); - oldFilesWarningIcon->setObjectName(QStringLiteral("oldFilesWarningIcon")); - QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); - sizePolicy.setHorizontalStretch(0); - sizePolicy.setVerticalStretch(0); - sizePolicy.setHeightForWidth(oldFilesWarningIcon->sizePolicy().hasHeightForWidth()); - oldFilesWarningIcon->setSizePolicy(sizePolicy); - oldFilesWarningIcon->setPixmap(Utils::Icons::WARNING.pixmap()); - oldFilesWarningIcon->setAlignment(Qt::Alignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop)); - qt51WarningLayout->addWidget(oldFilesWarningIcon); - - QLabel *oldFilesWarningLabel = new QLabel(this); - oldFilesWarningLabel->setObjectName(QStringLiteral("oldFilesWarningLabel")); - oldFilesWarningLabel->setWordWrap(true); - qt51WarningLayout->addWidget(oldFilesWarningLabel); - - topLayout->addWidget(new Android::AndroidBuildApkWidget(step)); - - QWidget *widget = new QWidget(this); - m_ui->setupUi(widget); - topLayout->addWidget(widget); - setLayout(topLayout); - - bool oldFiles = Android::AndroidManager::checkForQt51Files(m_step->project()->projectDirectory()); - oldFilesWarningIcon->setVisible(oldFiles); - oldFilesWarningLabel->setVisible(oldFiles); - m_extraLibraryListModel = new AndroidExtraLibraryListModel(m_step->target(), this); - m_ui->androidExtraLibsListView->setModel(m_extraLibraryListModel); - connect(m_ui->createAndroidTemplatesButton, &QAbstractButton::clicked, + auto base = new Android::AndroidBuildApkWidget(step); + base->layout()->setContentsMargins(0, 0, 0, 0); + + auto createTemplatesGroupBox = new QGroupBox(tr("Android")); + createTemplatesGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + + auto createAndroidTemplatesButton = new QPushButton(tr("Create Templates")); + + auto horizontalLayout = new QHBoxLayout(createTemplatesGroupBox); + horizontalLayout->addWidget(createAndroidTemplatesButton); + horizontalLayout->addStretch(1); + + auto additionalLibrariesGroupBox = new QGroupBox(tr("Additional Libraries")); + additionalLibrariesGroupBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); + + m_androidExtraLibsListView = new QListView; + m_androidExtraLibsListView->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_androidExtraLibsListView->setToolTip(tr("List of extra libraries to include in Android package and load on startup.")); + m_androidExtraLibsListView->setModel(m_extraLibraryListModel); + + auto addAndroidExtraLibButton = new QToolButton; + addAndroidExtraLibButton->setText(tr("Add...")); + addAndroidExtraLibButton->setToolTip(tr("Select library to include in package.")); + addAndroidExtraLibButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); + addAndroidExtraLibButton->setToolButtonStyle(Qt::ToolButtonTextOnly); + + m_removeAndroidExtraLibButton = new QToolButton; + m_removeAndroidExtraLibButton->setText(tr("Remove")); + m_removeAndroidExtraLibButton->setToolTip(tr("Remove currently selected library from list.")); + + auto androidExtraLibsButtonLayout = new QVBoxLayout(); + androidExtraLibsButtonLayout->addWidget(addAndroidExtraLibButton); + androidExtraLibsButtonLayout->addWidget(m_removeAndroidExtraLibButton); + androidExtraLibsButtonLayout->addStretch(1); + + auto androidExtraLibsLayout = new QHBoxLayout(additionalLibrariesGroupBox); + androidExtraLibsLayout->addWidget(m_androidExtraLibsListView); + androidExtraLibsLayout->addLayout(androidExtraLibsButtonLayout); + + auto topLayout = new QVBoxLayout(this); + topLayout->addWidget(base); + topLayout->addWidget(createTemplatesGroupBox); + topLayout->addWidget(additionalLibrariesGroupBox); + + connect(createAndroidTemplatesButton, &QAbstractButton::clicked, this, &QmakeAndroidBuildApkWidget::createAndroidTemplatesButton); - connect(m_ui->addAndroidExtraLibButton, &QAbstractButton::clicked, + connect(addAndroidExtraLibButton, &QAbstractButton::clicked, this, &QmakeAndroidBuildApkWidget::addAndroidExtraLib); - connect(m_ui->removeAndroidExtraLibButton, &QAbstractButton::clicked, + connect(m_removeAndroidExtraLibButton, &QAbstractButton::clicked, this, &QmakeAndroidBuildApkWidget::removeAndroidExtraLib); - connect(m_ui->androidExtraLibsListView->selectionModel(), &QItemSelectionModel::selectionChanged, + connect(m_androidExtraLibsListView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QmakeAndroidBuildApkWidget::checkEnableRemoveButton); connect(m_extraLibraryListModel, &AndroidExtraLibraryListModel::enabledChanged, - m_ui->additionalLibrariesGroupBox, &QWidget::setEnabled); + additionalLibrariesGroupBox, &QWidget::setEnabled); - m_ui->additionalLibrariesGroupBox->setEnabled(m_extraLibraryListModel->isEnabled()); -} - -QmakeAndroidBuildApkWidget::~QmakeAndroidBuildApkWidget() -{ - delete m_ui; + additionalLibrariesGroupBox->setEnabled(m_extraLibraryListModel->isEnabled()); } void QmakeAndroidBuildApkWidget::createAndroidTemplatesButton() @@ -120,13 +130,13 @@ void QmakeAndroidBuildApkWidget::addAndroidExtraLib() void QmakeAndroidBuildApkWidget::removeAndroidExtraLib() { - QModelIndexList removeList = m_ui->androidExtraLibsListView->selectionModel()->selectedIndexes(); + QModelIndexList removeList = m_androidExtraLibsListView->selectionModel()->selectedIndexes(); m_extraLibraryListModel->removeEntries(removeList); } void QmakeAndroidBuildApkWidget::checkEnableRemoveButton() { - m_ui->removeAndroidExtraLibButton->setEnabled(m_ui->androidExtraLibsListView->selectionModel()->hasSelection()); + m_removeAndroidExtraLibButton->setEnabled(m_androidExtraLibsListView->selectionModel()->hasSelection()); } QString QmakeAndroidBuildApkWidget::summaryText() const diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.h b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.h index d61d6a8c26..d10479e776 100644 --- a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.h +++ b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.h @@ -30,20 +30,18 @@ #include <projectexplorer/buildstep.h> #include <android/androidbuildapkstep.h> -#include <QWidget> +#include <QListView> +#include <QToolButton> namespace QmakeAndroidSupport { namespace Internal { -namespace Ui { class QmakeAndroidBuildApkWidget; } - class QmakeAndroidBuildApkWidget : public ProjectExplorer::BuildStepConfigWidget { Q_OBJECT public: explicit QmakeAndroidBuildApkWidget(Android::AndroidBuildApkStep *step); - ~QmakeAndroidBuildApkWidget(); private: void createAndroidTemplatesButton(); @@ -51,15 +49,16 @@ private: void removeAndroidExtraLib(); void checkEnableRemoveButton(); + QString summaryText() const final; + QString displayName() const final; + private: - Ui::QmakeAndroidBuildApkWidget *m_ui = nullptr; + QListView *m_androidExtraLibsListView = nullptr; + QToolButton *m_removeAndroidExtraLibButton = nullptr; + Android::AndroidBuildApkStep *m_step = nullptr; AndroidExtraLibraryListModel *m_extraLibraryListModel = nullptr; bool m_ignoreChange = false; - - // BuildStepConfigWidget interface - QString summaryText() const final; - QString displayName() const final; }; } // namespace Internal diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.ui b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.ui deleted file mode 100644 index 894a4bb689..0000000000 --- a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.ui +++ /dev/null @@ -1,135 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>QmakeAndroidSupport::Internal::QmakeAndroidBuildApkWidget</class> - <widget class="QWidget" name="QmakeAndroidSupport::Internal::QmakeAndroidBuildApkWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>680</width> - <height>435</height> - </rect> - </property> - <property name="windowTitle"> - <string/> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QGroupBox" name="additionalLibrariesGroupBox_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Android</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QPushButton" name="createAndroidTemplatesButton"> - <property name="text"> - <string>Create Templates</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="additionalLibrariesGroupBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Additional Libraries</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <layout class="QHBoxLayout" name="androidExtraLibsLayout"> - <item> - <widget class="QListView" name="androidExtraLibsListView"> - <property name="toolTip"> - <string>List of extra libraries to include in Android package and load on startup.</string> - </property> - <property name="selectionMode"> - <enum>QAbstractItemView::ExtendedSelection</enum> - </property> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="androidExtraLibsButtonLayout"> - <item> - <widget class="QToolButton" name="addAndroidExtraLibButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Select library to include in package.</string> - </property> - <property name="text"> - <string>Add...</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextOnly</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="removeAndroidExtraLibButton"> - <property name="toolTip"> - <string>Remove currently selected library from list.</string> - </property> - <property name="text"> - <string>Remove</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.pro b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.pro index 36c2699c02..6d2489e49a 100644 --- a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.pro +++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.pro @@ -21,5 +21,3 @@ SOURCES += \ qmakeandroidbuildapkwidget.cpp \ androidqmakebuildconfigurationfactory.cpp \ qmakeandroidsupportplugin.cpp - -FORMS += qmakeandroidbuildapkwidget.ui diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs index 81f1fbd09d..8a2eefbfee 100644 --- a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs +++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs @@ -24,7 +24,6 @@ QtcPlugin { "qmakeandroidbuildapkstep.h", "qmakeandroidbuildapkwidget.cpp", "qmakeandroidbuildapkwidget.h", - "qmakeandroidbuildapkwidget.ui", "androidqmakebuildconfigurationfactory.cpp", "androidqmakebuildconfigurationfactory.h", "qmakeandroidsupport.cpp", |