bug+codestyle: Fix compile bugs and adjust code style
Change-Id: I008bb538441c099fa25b8b967fbf23ffce13a220
diff --git a/src/endorse-combobox-delegate.cpp b/src/endorse-combobox-delegate.cpp
index 906020a..d881f18 100644
--- a/src/endorse-combobox-delegate.cpp
+++ b/src/endorse-combobox-delegate.cpp
@@ -8,7 +8,7 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "endorse-combobox-delegate.h"
+#include "endorse-combobox-delegate.hpp"
#include <QComboBox>
#include <QApplication>
@@ -17,9 +17,9 @@
#include "logging.h"
#endif
-INIT_LOGGER("EndorseComboBoxDelegate");
+namespace chronos {
-EndorseComboBoxDelegate::EndorseComboBoxDelegate(QObject *parent)
+EndorseComboBoxDelegate::EndorseComboBoxDelegate(QObject* parent)
: QItemDelegate(parent)
{
m_items.push_back("Not Endorsed");
@@ -28,43 +28,45 @@
QWidget*
-EndorseComboBoxDelegate::createEditor(QWidget *parent,
- const QStyleOptionViewItem &/* option */,
- const QModelIndex &/* index */) const
+EndorseComboBoxDelegate::createEditor(QWidget* parent,
+ const QStyleOptionViewItem& /* option */,
+ const QModelIndex& /* index */) const
{
QComboBox* editor = new QComboBox(parent);
- for(unsigned int i = 0; i < m_items.size(); ++i)
- editor->addItem(m_items[i].c_str());
+ for (unsigned int i = 0; i < m_items.size(); ++i)
+ editor->addItem(m_items[i].c_str());
return editor;
}
void
-EndorseComboBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
+EndorseComboBoxDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
{
- QComboBox *comboBox = static_cast<QComboBox*>(editor);
+ QComboBox* comboBox = static_cast<QComboBox*>(editor);
int value = index.model()->data(index, Qt::EditRole).toUInt();
comboBox->setCurrentIndex(value);
}
void
-EndorseComboBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
+EndorseComboBoxDelegate::setModelData(QWidget* editor,
+ QAbstractItemModel* model,
+ const QModelIndex& index) const
{
- QComboBox *comboBox = static_cast<QComboBox*>(editor);
+ QComboBox* comboBox = static_cast<QComboBox*>(editor);
model->setData(index, comboBox->currentIndex(), Qt::EditRole);
}
void
-EndorseComboBoxDelegate::updateEditorGeometry(QWidget *editor,
- const QStyleOptionViewItem &option,
- const QModelIndex &/* index */) const
+EndorseComboBoxDelegate::updateEditorGeometry(QWidget* editor,
+ const QStyleOptionViewItem& option,
+ const QModelIndex& /* index */) const
{
editor->setGeometry(option.rect);
}
void
-EndorseComboBoxDelegate::paint(QPainter *painter,
- const QStyleOptionViewItem &option,
- const QModelIndex &index) const
+EndorseComboBoxDelegate::paint(QPainter* painter,
+ const QStyleOptionViewItem& option,
+ const QModelIndex& index) const
{
QStyleOptionViewItemV4 myOption = option;
QString text = m_items[index.model()->data(index, Qt::EditRole).toUInt()].c_str();
@@ -74,6 +76,8 @@
QApplication::style()->drawControl(QStyle::CE_ItemViewItem, &myOption, painter);
}
+} // namespace chronos
+
#if WAF
#include "endorse-combobox-delegate.moc"
#include "endorse-combobox-delegate.cpp.moc"