diff options
author | Piotr Galiszewski <piotr@galiszewski.pl> | 2010-07-15 13:29:58 +0200 |
---|---|---|
committer | Piotr Galiszewski <piotr@galiszewski.pl> | 2010-07-22 16:33:54 +0200 |
commit | 116146da81026b6acb748a12e37d31edea74f1c8 (patch) | |
tree | 55fb90cb89cfb666774699098b55f701c3f14c59 /src/qt | |
parent | 833d98eea7d687975c000b4a60f6bb2594ac0513 (diff) | |
download | aptitude-116146da81026b6acb748a12e37d31edea74f1c8.tar.gz |
Implementation of Packages Tab look
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/widgets/packages_tab.cc | 93 | ||||
-rw-r--r-- | src/qt/widgets/packages_tab.h | 34 |
2 files changed, 125 insertions, 2 deletions
diff --git a/src/qt/widgets/packages_tab.cc b/src/qt/widgets/packages_tab.cc index a81eecbc..3b1be637 100644 --- a/src/qt/widgets/packages_tab.cc +++ b/src/qt/widgets/packages_tab.cc @@ -17,8 +17,21 @@ // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +// Local includes: #include "packages_tab.h" +#include "aptitude.h" + +// System includes: +#include <QtGui/QComboBox> +#include <QtGui/QHBoxLayout> +#include <QtGui/QLabel> +#include <QtGui/QLineEdit> +#include <QtGui/QListView> +#include <QtGui/QPushButton> +#include <QtGui/QTreeView> +#include <QtGui/QVBoxLayout> + namespace aptitude { namespace gui @@ -28,11 +41,91 @@ namespace aptitude packages_tab::packages_tab(QWidget *parent) : tab(tab::tab_packages, tab::closing_policy_destroy, parent) { + create_gui(); } packages_tab::~packages_tab() { } + + void packages_tab::create_gui() + { + QHBoxLayout *layout = new QHBoxLayout(this); + layout->setMargin(0); + layout->setSpacing(0); + + layout->addWidget(create_left_widget()); + layout->addWidget(create_right_widget()); + layout->setStretch(1, 100); + } + + QWidget * packages_tab::create_left_widget() + { + QWidget *left_widget = new QWidget(); + QVBoxLayout *left_layout = new QVBoxLayout(left_widget); + + QWidget *show_widget = new QWidget(); + QHBoxLayout *show_layout = new QHBoxLayout(show_widget); + + // TODO: this should be ShowOptionsModel + QStringList show_tems; + show_tems << _("all") << _("installed") << _("installed locally") << _("new") + << _("not installed") << _("virtual"); + + show_combobox = new QComboBox(); + show_combobox->addItems(show_tems); + + show_layout->addWidget(new QLabel(_("Show:"))); + show_layout->addWidget(show_combobox); + + filters_view = new QListView(); + filters_view->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Expanding)); + + manage_filters_button = new QPushButton(_("Manage Filters")); + connect(manage_filters_button, SIGNAL(clicked()), this, SLOT(manage_filters_cliked())); + + left_layout->addWidget(show_widget); + left_layout->addWidget(filters_view); + left_layout->addWidget(manage_filters_button); + + return left_widget; + } + + QWidget * packages_tab::create_right_widget() + { + QWidget *right_widget = new QWidget(); + QVBoxLayout *right_layout = new QVBoxLayout(right_widget); + + QWidget *search_widget = new QWidget(); + QHBoxLayout *search_layout = new QHBoxLayout(search_widget); + + search_edit = new QLineEdit(); + + QStringList search_items; + search_items << _("Name") << _("Name and Description") << _("Maintainer") << _("Version"); + + search_by_combobox = new QComboBox(); + search_by_combobox->addItems(search_items); + + search_layout->addStretch(); + search_layout->addWidget(new QLabel(_("Find:"))); + search_layout->addWidget(search_edit); + search_layout->addWidget(new QLabel(_("by"))); + search_layout->addWidget(search_by_combobox); + + packages_view = new QTreeView(); + packages_view->setRootIsDecorated(false); + + right_layout->addWidget(search_widget); + right_layout->addWidget(packages_view); + + return right_widget; + } + + void packages_tab::manage_filters_cliked() + { + + } } } } diff --git a/src/qt/widgets/packages_tab.h b/src/qt/widgets/packages_tab.h index 0f2812f0..3cb01654 100644 --- a/src/qt/widgets/packages_tab.h +++ b/src/qt/widgets/packages_tab.h @@ -20,8 +20,15 @@ #ifndef APTITUDE_QT_PACKAGES_TAB_H #define APTITUDE_QT_PACKAGES_TAB_H +// Local includes #include "tab.h" +class QComboBox; +class QLineEdit; +class QListView; +class QPushButton; +class QTreeView; + namespace aptitude { namespace gui @@ -33,13 +40,36 @@ namespace aptitude */ class packages_tab : public tab { - Q_OBJECT + Q_OBJECT + + QComboBox *show_combobox; + QListView *filters_view; + QPushButton *manage_filters_button; + + QComboBox *search_by_combobox; + QLineEdit *search_edit; + QTreeView *packages_view; + + /** \brief Create layouts and widgets. */ + void create_gui(); + + /** \brief Create left widget. */ + QWidget *create_left_widget(); + + /** \brief Create right widget. */ + QWidget *create_right_widget(); + + private Q_SLOTS: + /** \brief Slot invoked when user clicked on Manage Filters button + * + * \todo This slot should open Manage Filters window + */ + void manage_filters_cliked(); public: /** \brief Create a new packages_tab object. */ explicit packages_tab(QWidget *parent = 0); - /** \brief Destroy a packages_tab object. */ virtual ~packages_tab(); }; } |