Added unit tests.
[situare] / src / ui / tagsdialog.cpp
index a101a49..7aaa42e 100644 (file)
@@ -26,6 +26,7 @@ TagsDialog::TagsDialog(const QHash<QString, QString> &tags, QWidget *parent)
     QVBoxLayout *mainLayout = new QVBoxLayout;
     QHBoxLayout *lineEditLayout = new QHBoxLayout;
     QGridLayout *listLayout = new QGridLayout;
+    QVBoxLayout *buttonLayout = new QVBoxLayout;
 
     m_addTagEdit = new QLineEdit("");
     QPushButton *addButton = new QPushButton(tr("Add"));
@@ -33,8 +34,9 @@ TagsDialog::TagsDialog(const QHash<QString, QString> &tags, QWidget *parent)
     lineEditLayout->addWidget(addButton);
 
     QPushButton *deleteButton = new QPushButton(tr("Delete"));
-    QPushButton *cancelButton = new QPushButton(tr("Cancel"));
     QPushButton *okButton = new QPushButton(tr("Update"));
+    buttonLayout->addWidget(deleteButton, 0, Qt::AlignBottom);
+    buttonLayout->addWidget(okButton, 0, Qt::AlignBottom);
 
     QLabel *yourTagsLabel = new QLabel(tr("Your tags:"));
     yourTagsLabel->setAlignment(Qt::AlignCenter);
@@ -42,11 +44,13 @@ TagsDialog::TagsDialog(const QHash<QString, QString> &tags, QWidget *parent)
     popularTagsLabel->setAlignment(Qt::AlignCenter);
     m_userTagsView = new QListWidget();
     m_popularTagsView = new QListWidget();
+    m_popularTagsView->setSelectionMode(QAbstractItemView::NoSelection);
 
     listLayout->addWidget(yourTagsLabel, 0, 0);
     listLayout->addWidget(popularTagsLabel, 0, 1);
     listLayout->addWidget(m_userTagsView, 1, 0);
-    listLayout->addWidget(m_userTagsView, 1, 1);
+    listLayout->addWidget(m_popularTagsView, 1, 1);
+    listLayout->addLayout(buttonLayout, 0, 2, -1, 1);
 
     mainLayout->addLayout(lineEditLayout);
     mainLayout->addLayout(listLayout);
@@ -56,9 +60,6 @@ TagsDialog::TagsDialog(const QHash<QString, QString> &tags, QWidget *parent)
     connect(okButton, SIGNAL(clicked()),
             this, SLOT(accept()));
 
-    connect(cancelButton, SIGNAL(clicked()),
-            this, SLOT(reject()));
-
     connect(addButton, SIGNAL(clicked()),
             this, SLOT(addTagToList()));
 
@@ -116,6 +117,8 @@ QStringList TagsDialog::removedTags()
 
 void TagsDialog::populatePopularTags(const QHash<QString, QString> &popularTags)
 {
+    qDebug() << __PRETTY_FUNCTION__;
+
     m_popularTagsView->clear();
 
     foreach (QString tag, popularTags)
@@ -124,6 +127,8 @@ void TagsDialog::populatePopularTags(const QHash<QString, QString> &popularTags)
 
 void TagsDialog::populateUserTags(const QHash<QString, QString> &userTags)
 {
+    qDebug() << __PRETTY_FUNCTION__;
+
     m_userTagsView->clear();
 
     foreach (QString tag, m_newTags) {