From 201cba6c77c0a01526b610dc1b4a8959d1cc8ca2 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Wed, 30 Sep 2015 17:24:37 +0200 Subject: [PATCH] UIfy ChoicePage. --- src/modules/partition/CMakeLists.txt | 1 + src/modules/partition/gui/ChoicePage.cpp | 37 +++++---------- src/modules/partition/gui/ChoicePage.h | 8 ++-- src/modules/partition/gui/ChoicePage.ui | 58 ++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 31 deletions(-) create mode 100644 src/modules/partition/gui/ChoicePage.ui diff --git a/src/modules/partition/CMakeLists.txt b/src/modules/partition/CMakeLists.txt index c88606a08..c5f211eef 100644 --- a/src/modules/partition/CMakeLists.txt +++ b/src/modules/partition/CMakeLists.txt @@ -54,6 +54,7 @@ calamares_add_plugin( partition jobs/PartitionJob.cpp jobs/ResizePartitionJob.cpp UI + gui/ChoicePage.ui gui/CreatePartitionDialog.ui gui/CreatePartitionTableDialog.ui gui/EditExistingPartitionDialog.ui diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index 9a1086083..0fb4fc2f5 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -45,47 +45,32 @@ ChoicePage::ChoicePage( QWidget* parent ) , m_nextEnabled( false ) , m_core( nullptr ) { - QBoxLayout* mainLayout = new QVBoxLayout; - setLayout( mainLayout ); + setupUi( this ); - m_messageLabel = new QLabel; m_messageLabel->setWordWrap( true ); - m_itemsLayout = new QVBoxLayout; CalamaresUtils::unmarginLayout( m_itemsLayout ); - /// Drive selector + preview - QLabel* driveLabel = new QLabel( this ); - mainLayout->addWidget( driveLabel ); - CALAMARES_RETRANSLATE( driveLabel->setText( tr( "Select drive:" ) ); ) + // Drive selector + preview + CALAMARES_RETRANSLATE( m_drivesLabel->setText( tr( "Select drive:" ) ); ) - m_drivesView = new QListView; - mainLayout->addWidget( m_drivesView ); - m_drivesView->setViewMode( QListView::IconMode ); + m_drivesView->setViewMode( QListView::ListMode ); m_drivesView->setWrapping( false ); - m_drivesView->setFlow( QListView::LeftToRight ); + m_drivesView->setFlow( QListView::TopToBottom ); m_drivesView->setSelectionRectVisible( false ); m_drivesView->setWordWrap( true ); m_drivesView->setUniformItemSizes( true ); m_drivesView->setSelectionMode( QAbstractItemView::SingleSelection ); - m_drivesView->setIconSize( CalamaresUtils::defaultIconSize() * 3 ); - m_drivesView->setGridSize( QSize( CalamaresUtils::defaultFontHeight() * 8, - m_drivesView->iconSize().height() + - CalamaresUtils::defaultFontHeight() * 4 ) ); - m_drivesView->setMinimumHeight( m_drivesView->gridSize().height() + - CalamaresUtils::defaultFontHeight() / 2 ); - m_drivesView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); + m_drivesView->setIconSize( CalamaresUtils::defaultIconSize() / 2 ); +// m_drivesView->setGridSize( QSize( CalamaresUtils::defaultFontHeight() * 8, +// m_drivesView->iconSize().height() + +// CalamaresUtils::defaultFontHeight() * 4 ) ); +// m_drivesView->setMinimumHeight( m_drivesView->gridSize().height() + +// CalamaresUtils::defaultFontHeight() / 2 ); - m_previewFrame = new QWidget; m_previewFrame->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); - mainLayout->addWidget( m_previewFrame ); // end - - //mainLayout->addSpacing( CalamaresUtils::defaultFontHeight() ); - mainLayout->addWidget( m_messageLabel ); - mainLayout->addLayout( m_itemsLayout ); - mainLayout->addStretch(); } diff --git a/src/modules/partition/gui/ChoicePage.h b/src/modules/partition/gui/ChoicePage.h index 6571910e2..2b6cbc037 100644 --- a/src/modules/partition/gui/ChoicePage.h +++ b/src/modules/partition/gui/ChoicePage.h @@ -19,6 +19,8 @@ #ifndef CHOICEPAGE_H #define CHOICEPAGE_H +#include "ui_ChoicePage.h" + #include #include "core/OsproberEntry.h" @@ -31,7 +33,7 @@ class QListView; class PartitionCoreModule; -class ChoicePage : public QWidget +class ChoicePage : public QWidget, private Ui::ChoicePage { Q_OBJECT public: @@ -62,11 +64,7 @@ private: bool m_nextEnabled; PartitionCoreModule* m_core; - QBoxLayout* m_itemsLayout; - QLabel* m_messageLabel; - QListView* m_drivesView; - QWidget* m_previewFrame; QMutex m_previewsMutex; Choice m_choice; diff --git a/src/modules/partition/gui/ChoicePage.ui b/src/modules/partition/gui/ChoicePage.ui new file mode 100644 index 000000000..f60d469ad --- /dev/null +++ b/src/modules/partition/gui/ChoicePage.ui @@ -0,0 +1,58 @@ + + + ChoicePage + + + + 0 + 0 + 743 + 512 + + + + Form + + + + + + + + + + + <m_drivesLabel> + + + + + + + + + + + + + + + + + <m_messageLabel> + + + + + + + + + + + + + + + +