From bde397503ebc7cd678886fd561dd8a8f69bc967f Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Sun, 20 May 2012 23:14:34 +0200 Subject: [PATCH] Coding style fixes. --- src/gui/DatabaseWidget.cpp | 1 - src/gui/DatabaseWidget.h | 2 +- src/gui/DragTabBar.h | 8 ++++---- src/gui/LineEdit.cpp | 32 ++++++++++++++++---------------- src/gui/LineEdit.h | 7 +++---- src/gui/entry/EditEntryWidget.h | 4 ++-- src/gui/entry/EntryView.cpp | 6 +++--- tests/gui/TestGui.cpp | 1 - 8 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 6a7dd2f39..b172ce278 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -45,7 +45,6 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent) , m_newEntry(0) , m_newParent(0) { - m_searchUi->setupUi(m_searchWidget); m_searchTimer = new QTimer(this); diff --git a/src/gui/DatabaseWidget.h b/src/gui/DatabaseWidget.h index ce218e9d6..041c7e29c 100644 --- a/src/gui/DatabaseWidget.h +++ b/src/gui/DatabaseWidget.h @@ -77,7 +77,7 @@ public Q_SLOTS: private Q_SLOTS: void switchBackToEntryEdit(); void switchToView(bool accepted); - void switchToHistoryView(Entry *entry); + void switchToHistoryView(Entry* entry); void switchToEntryEdit(Entry* entry); void switchToEntryEdit(Entry* entry, bool create); void switchToGroupEdit(Group* entry, bool create); diff --git a/src/gui/DragTabBar.h b/src/gui/DragTabBar.h index a9232d172..1bb3238b2 100644 --- a/src/gui/DragTabBar.h +++ b/src/gui/DragTabBar.h @@ -15,8 +15,8 @@ * along with this program. If not, see . */ -#ifndef KEEPASSX_DRAGTABWIDGET_H -#define KEEPASSX_DRAGTABWIDGET_H +#ifndef KEEPASSX_DRAGTABBAR_H +#define KEEPASSX_DRAGTABBAR_H #include @@ -25,7 +25,7 @@ class DragTabBar : public QTabBar Q_OBJECT public: - DragTabBar(QWidget* parent = 0); + explicit DragTabBar(QWidget* parent = 0); protected: void dragEnterEvent(QDragEnterEvent* event); @@ -42,4 +42,4 @@ private: int m_tabSwitchIndex; }; -#endif // KEEPASSX_DRAGTABWIDGET_H +#endif // KEEPASSX_DRAGTABBAR_H diff --git a/src/gui/LineEdit.cpp b/src/gui/LineEdit.cpp index 4879fdeb7..b8aa851eb 100644 --- a/src/gui/LineEdit.cpp +++ b/src/gui/LineEdit.cpp @@ -17,34 +17,34 @@ LineEdit::LineEdit(QWidget* parent) : QLineEdit(parent) { - clearButton = new QToolButton(this); - clearButton->setObjectName("clearButton"); + m_clearButton = new QToolButton(this); + m_clearButton->setObjectName("clearButton"); QIcon icon = dataPath()->icon("action", "edit-clear-locationbar-rtl"); - clearButton->setIcon(icon); - clearButton->setCursor(Qt::ArrowCursor); - clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); - clearButton->hide(); - connect(clearButton, SIGNAL(clicked()), this, SLOT(clear())); + m_clearButton->setIcon(icon); + m_clearButton->setCursor(Qt::ArrowCursor); + m_clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); + m_clearButton->hide(); + connect(m_clearButton, SIGNAL(clicked()), this, SLOT(clear())); connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateCloseButton(const QString&))); int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth); setStyleSheet(QString("QLineEdit { padding-right: %1px; } ") - .arg(clearButton->sizeHint().width() + frameWidth + 1)); + .arg(m_clearButton->sizeHint().width() + frameWidth + 1)); QSize msz = minimumSizeHint(); - setMinimumSize(qMax(msz.width(), clearButton->sizeHint().height() + frameWidth * 2 + 2), - qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2)); + setMinimumSize(qMax(msz.width(), m_clearButton->sizeHint().height() + frameWidth * 2 + 2), + qMax(msz.height(), m_clearButton->sizeHint().height() + frameWidth * 2 + 2)); } -void LineEdit::resizeEvent(QResizeEvent*) +void LineEdit::resizeEvent(QResizeEvent* event) { - QSize sz = clearButton->sizeHint(); + Q_UNUSED(event); + + QSize sz = m_clearButton->sizeHint(); int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth); - clearButton->move(rect().right() - frameWidth - sz.width(), + m_clearButton->move(rect().right() - frameWidth - sz.width(), (rect().bottom() + 1 - sz.height())/2); } void LineEdit::updateCloseButton(const QString& text) { - clearButton->setVisible(!text.isEmpty()); + m_clearButton->setVisible(!text.isEmpty()); } - - diff --git a/src/gui/LineEdit.h b/src/gui/LineEdit.h index f74a9474e..85ddb7c76 100644 --- a/src/gui/LineEdit.h +++ b/src/gui/LineEdit.h @@ -19,17 +19,16 @@ class LineEdit : public QLineEdit Q_OBJECT public: - LineEdit(QWidget* parent = 0); + explicit LineEdit(QWidget* parent = 0); protected: - void resizeEvent(QResizeEvent*); + void resizeEvent(QResizeEvent* event); private Q_SLOTS: void updateCloseButton(const QString& text); private: - QToolButton* clearButton; + QToolButton* m_clearButton; }; #endif // KEEPASSX_LINEEDIT_H - diff --git a/src/gui/entry/EditEntryWidget.h b/src/gui/entry/EditEntryWidget.h index 17b95fdda..89a07815d 100644 --- a/src/gui/entry/EditEntryWidget.h +++ b/src/gui/entry/EditEntryWidget.h @@ -50,7 +50,7 @@ public: ~EditEntryWidget(); void loadEntry(Entry* entry, bool create, bool history, const QString& groupName, - Database *database); + Database* database); static const QColor CorrectSoFarColor; static const QColor ErrorColor; @@ -75,7 +75,7 @@ private Q_SLOTS: void restoreHistoryEntry(); void deleteHistoryEntry(); void deleteAllHistoryEntries(); - void emitHistoryEntryActivated(const QModelIndex &index); + void emitHistoryEntryActivated(const QModelIndex& index); void updateHistoryButtons(const QModelIndex& current, const QModelIndex& previous); private: diff --git a/src/gui/entry/EntryView.cpp b/src/gui/entry/EntryView.cpp index e376d8434..7c83e97a7 100644 --- a/src/gui/entry/EntryView.cpp +++ b/src/gui/entry/EntryView.cpp @@ -40,10 +40,10 @@ EntryView::EntryView(QWidget* parent) setDragEnabled(true); setSortingEnabled(true); - connect(this, SIGNAL(activated(const QModelIndex&)), SLOT(emitEntryActivated(const QModelIndex&))); + connect(this, SIGNAL(activated(QModelIndex)), SLOT(emitEntryActivated(QModelIndex))); connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(entrySelectionChanged())); - connect(m_model, SIGNAL(switchedToSearch()), this, SLOT(switchToSearch())); - connect(m_model, SIGNAL(switchedToView()), this, SLOT(switchToView())); + connect(m_model, SIGNAL(switchedToSearch()), SLOT(switchToSearch())); + connect(m_model, SIGNAL(switchedToView()), SLOT(switchToView())); sortByColumn(0, Qt::AscendingOrder); } diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index 90acfdce1..1f48b2b0c 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -213,7 +213,6 @@ void TestGui::testSearch() QTest::qWait(20); QCOMPARE(entryView->model()->rowCount(), 1); - } void TestGui::cleanupTestCase()