- write logfile for debugging purposes
[buliscores] / src / matchdaymodel.cpp
index 0ebb41c..7528a97 100644 (file)
@@ -17,8 +17,8 @@ MatchDayModel::MatchDayModel(QObject *parent, MatchDayBackend *backend) :
 {
     m_backend = backend;
 
-    connect(m_backend, SIGNAL(matchListChanged()),
-            this, SLOT(onMatchListChanged()));
+    connect(m_backend, SIGNAL(updateFinished()),
+            this, SLOT(onUpdateFinished()));
 }
 
 int MatchDayModel::rowCount(const QModelIndex&) const
@@ -30,7 +30,7 @@ int MatchDayModel::rowCount(const QModelIndex&) const
 
 int MatchDayModel::columnCount(const QModelIndex&) const
 {
-    return 10;
+    return 11;
 }
 
 QVariant MatchDayModel::data(const QModelIndex& index, int role) const
@@ -49,6 +49,7 @@ QVariant MatchDayModel::data(const QModelIndex& index, int role) const
     case Qt::BackgroundRole:
         return QBrush(QColor(20, 20, 20, 100));
         break;
+
     case Qt::DecorationRole:
         switch (index.column()) {
         case AwayIcon:
@@ -120,8 +121,9 @@ QVariant MatchDayModel::data(const QModelIndex& index, int role) const
         s.setHeight(25);
         switch (index.column()) {
         case Spacer:
-            s.setWidth(3);
-            break;
+        case Spacer2:
+            s.setWidth(2);
+            break;            
         case MatchState:
             s.setWidth(15);
             break;
@@ -179,18 +181,17 @@ QVariant MatchDayModel::data(const QModelIndex& index, int role) const
 }
 
 
-// only adds for now
-void MatchDayModel::onMatchListChanged(void)
+void MatchDayModel::onUpdateFinished(void)
 {
     //remove all rows
-    //qDebug() << "beginRemoveRows: " << 0 << ", " << rowCount(QModelIndex()) - 1;
+    qDebug() << "beginRemoveRows: " << 0 << ", " << rowCount(QModelIndex()) - 1;
     beginRemoveRows(QModelIndex(),
                     0,
                     m_lastRowCount);
     endRemoveRows();
 
     //add rows
-    //qDebug() << "beginInsertRows: " << 0 << ", " << m_backend->matchList().count() - 1;
+    qDebug() << "beginInsertRows: " << 0 << ", " << m_backend->matchList().count() - 1;
     beginInsertRows(QModelIndex(),
                     0,
                     m_backend->matchList().count() - 1);
@@ -199,7 +200,7 @@ void MatchDayModel::onMatchListChanged(void)
     m_lastRowCount = m_backend->matchList().count() - 1;
 
     // invalidate complete data
-    //qDebug() << "rowCount @ emit dataChanged: " << rowCount(QModelIndex());
+    qDebug() << "rowCount @ emit dataChanged: " << rowCount(QModelIndex());
     emit dataChanged(index(0, 0),
                      index(rowCount(QModelIndex()) - 1, columnCount(QModelIndex()) - 1));