From ffe49fc9cc4e16f1f300e7e2468036d9dd6529b7 Mon Sep 17 00:00:00 2001 From: David Solbach Date: Sun, 7 Nov 2010 21:42:20 +0100 Subject: [PATCH] - highlight goals updated less than 5 minutes ago - bigger font for scores --- buliscores.pro.user | 350 ++++++++++++++------------------------------- src/resources.qrc | 1 + src/src/mainwidget.cpp | 13 +- src/src/mainwidget.h | 3 +- src/src/match.cpp | 17 +-- src/src/match.h | 9 +- src/src/matchdaymodel.cpp | 20 ++- 7 files changed, 145 insertions(+), 268 deletions(-) diff --git a/buliscores.pro.user b/buliscores.pro.user index ac6109c..0b7e592 100644 --- a/buliscores.pro.user +++ b/buliscores.pro.user @@ -16,7 +16,7 @@ Desktop Qt4ProjectManager.Target.DesktopTarget 0 - 0 + 4 qmake @@ -47,7 +47,7 @@ Qt4ProjectManager.Qt4BuildConfiguration 2 /home/david/Projects/buliscores-build-desktop - 4 + 2 0 true @@ -81,12 +81,64 @@ Qt4ProjectManager.Qt4BuildConfiguration 0 /home/david/Projects/buliscores-build-desktop - 4 + 2 0 true 2 + cmdline_tester + Qt4ProjectManager.Qt4RunConfiguration + 2 + + qjson/tests/cmdline_tester/cmdline_tester.pro + false + false + + false + false + + + + parser + Qt4ProjectManager.Qt4RunConfiguration + 2 + + qjson/tests/parser/parser.pro + false + false + + false + false + + + + qobjecthelper + Qt4ProjectManager.Qt4RunConfiguration + 2 + + qjson/tests/qobjecthelper/qobjecthelper.pro + false + false + + false + false + + + + serializer + Qt4ProjectManager.Qt4RunConfiguration + 2 + + qjson/tests/serializer/serializer.pro + false + false + + false + false + + + src Qt4ProjectManager.Qt4RunConfiguration 2 @@ -99,7 +151,7 @@ false - 1 + 5 @@ -107,7 +159,7 @@ Maemo Qt4ProjectManager.Target.MaemoDeviceTarget - 2 + 0 0 @@ -123,94 +175,6 @@ - false - - Qt4ProjectManager.MaemoPackageCreationStep - - true - /usr/local/bin/buliscores - - 0.0.1 - - 3 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - /home/david/Projects/buliscores-build-maemo - 7 - 9 - true - - - - qmake - QtProjectManager.QMakeBuildStep - - - - Make - Qt4ProjectManager.MakeStep - false - - - - - true - - Qt4ProjectManager.MaemoPackageCreationStep - - true - - - 0.0.1 - - 3 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - /home/david/Projects/buliscores-build-maemo - 7 - 9 - true - - - - qmake - QtProjectManager.QMakeBuildStep - - - - Make - Qt4ProjectManager.MakeStep - false - - - - true Qt4ProjectManager.MaemoPackageCreationStep @@ -241,15 +205,15 @@ 1 false - Qt for Fremantle PR1.3 Devices (Nokia Qt SDK) Debug + Debug Qt4ProjectManager.Qt4BuildConfiguration 2 /home/david/Projects/buliscores-build-maemo - 7 + 15 9 true - + qmake QtProjectManager.QMakeBuildStep @@ -285,192 +249,88 @@ 1 false - Qt for Fremantle PR1.3 Devices (Nokia Qt SDK) Release + Release Qt4ProjectManager.Qt4BuildConfiguration 0 /home/david/Projects/buliscores-build-maemo - 7 + 15 9 true - 4 + 2 - src/src.pro + qjson/tests/cmdline_tester/cmdline_tester.pro Neue Maemo-Ausführungskonfiguration Qt4ProjectManager.MaemoRunConfiguration 1 192.168.2.102 - /home/david/Projects/buliscores-build-maemo/buliscores_0.0.1_armel.deb 192.168.2.102 /home/david/Projects/buliscores-build-maemo/buliscores_0.0.1_armel.deb - 192.168.2.102 - /home/david/Projects/buliscores-build-maemo/buliscores + /home/david/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim/usr/share/qt4/qtc-debugging-helper/libgdbmacros.so /home/developer/buliscores_0.0.1_armel.deb - /home/developer/buliscores_0.0.1_armel.deb - /usr/local/bin/buliscores + /home/developer/libgdbmacros.so - 2010-11-07T17:26:58 - 2010-11-03T14:09:15 - 2010-11-02T15:07:20 + 2010-11-07T21:41:34 + 2010-11-07T21:33:18 - 1 - - - - ProjectExplorer.Project.Target.2 - - Qt Simulator - Qt4ProjectManager.Target.QtSimulatorTarget - 0 - 0 - - - qmake - QtProjectManager.QMakeBuildStep - - - - Make - Qt4ProjectManager.MakeStep - false - - - - 2 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - /home/david/Projects/buliscores-build-simulator - 2 - 0 - true - - - - qmake - QtProjectManager.QMakeBuildStep - - - - Make - Qt4ProjectManager.MakeStep - false - - - - 2 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - /home/david/Projects/buliscores-build-simulator - 2 - 0 - true - - 2 - - cmdline_tester - Qt4ProjectManager.Qt4RunConfiguration - 2 - - qjson/tests/cmdline_tester/cmdline_tester.pro - false - false - - false - false - - - parser - Qt4ProjectManager.Qt4RunConfiguration - 2 - - qjson/tests/parser/parser.pro - false - false - - false - false - + qjson/tests/parser/parser.pro + Neue Maemo-Ausführungskonfiguration + Qt4ProjectManager.MaemoRunConfiguration + + 1 + + + + - qobjecthelper - Qt4ProjectManager.Qt4RunConfiguration - 2 - - qjson/tests/qobjecthelper/qobjecthelper.pro - false - false - - false - false - + qjson/tests/qobjecthelper/qobjecthelper.pro + Neue Maemo-Ausführungskonfiguration + Qt4ProjectManager.MaemoRunConfiguration + + 1 + + + + - serializer - Qt4ProjectManager.Qt4RunConfiguration - 2 - - qjson/tests/serializer/serializer.pro - false - false - - false - false - + qjson/tests/serializer/serializer.pro + Neue Maemo-Ausführungskonfiguration + Qt4ProjectManager.MaemoRunConfiguration + + 1 + + + + - src - Qt4ProjectManager.Qt4RunConfiguration - 2 - - src/src.pro - false - false - - false - false - + src/src.pro + Neue Maemo-Ausführungskonfiguration + Qt4ProjectManager.MaemoRunConfiguration + + 1 + + + + 5 ProjectExplorer.Project.TargetCount - 3 + 2 ProjectExplorer.Project.Updater.FileVersion diff --git a/src/resources.qrc b/src/resources.qrc index ff0e3af..c72dc2a 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -4,6 +4,7 @@ images/application/grau.gif images/application/gruen.gif images/application/rot.gif + images/application/Fussball.png images/teams/Bundesliga1/Bayern.png diff --git a/src/src/mainwidget.cpp b/src/src/mainwidget.cpp index d1441b6..cabaece 100644 --- a/src/src/mainwidget.cpp +++ b/src/src/mainwidget.cpp @@ -12,7 +12,8 @@ MainWidget::MainWidget(QWidget *parent) : QWidget(parent), m_mediaObject_tor(new Phonon::MediaObject(this)), m_mediaObject_pfeife(new Phonon::MediaObject(this)), - m_audioOutput(new Phonon::AudioOutput(Phonon::MusicCategory, this)), + m_audioOutput_tor(new Phonon::AudioOutput(Phonon::MusicCategory, this)), + m_audioOutput_pfeife(new Phonon::AudioOutput(Phonon::MusicCategory, this)), m_backend(new BackendKicker(this)), m_datamodel(new MatchDayModel(this, m_backend)), m_scoretbl(new ScoreTable(m_datamodel)), @@ -60,8 +61,8 @@ MainWidget::MainWidget(QWidget *parent) : m_mediaObject_tor->setCurrentSource(Phonon::MediaSource("/usr/share/buliscores/tor.wav")); m_mediaObject_pfeife->setCurrentSource(Phonon::MediaSource("/usr/share/buliscores/trillerpfeife.wav")); - Phonon::createPath(m_mediaObject_tor, m_audioOutput); - Phonon::createPath(m_mediaObject_pfeife, m_audioOutput); + Phonon::createPath(m_mediaObject_tor, m_audioOutput_tor); + Phonon::createPath(m_mediaObject_pfeife, m_audioOutput_pfeife); } void MainWidget::mousePressEvent(QMouseEvent* event) @@ -72,10 +73,12 @@ void MainWidget::mousePressEvent(QMouseEvent* event) if (event->button() == Qt::RightButton) { this->showSettingsDialog(); } else { -// qDebug() << "current volume: " << m_audioOutput->volumeDecibel(); +// qDebug() << "current volume: " << m_audioOutput_pfeife->volume(); // qDebug() << "MO state: " << m_mediaObject_pfeife->state(); // m_mediaObject_pfeife->seek(0); -// m_mediaObject_pfeife->play(); +// if (m_settings.value("Sounds", false).toBool()) { +// m_mediaObject_pfeife->play(); +// } // qDebug() << "MO state 2: " << m_mediaObject_pfeife->state(); } } diff --git a/src/src/mainwidget.h b/src/src/mainwidget.h index 2d26999..6d0ecb5 100644 --- a/src/src/mainwidget.h +++ b/src/src/mainwidget.h @@ -35,7 +35,8 @@ protected slots: private: Phonon::MediaObject *m_mediaObject_tor; Phonon::MediaObject *m_mediaObject_pfeife; - Phonon::AudioOutput *m_audioOutput; + Phonon::AudioOutput *m_audioOutput_tor; + Phonon::AudioOutput *m_audioOutput_pfeife; MatchDayBackend* m_backend; MatchDayModel* m_datamodel; diff --git a/src/src/match.cpp b/src/src/match.cpp index b65ad4b..cb8fdb6 100644 --- a/src/src/match.cpp +++ b/src/src/match.cpp @@ -4,7 +4,6 @@ Match::Match(QString hometeam, QString awayteam, QDateTime date, QObject *parent QObject(parent) { m_date = date; - m_lastevent = QDateTime::currentDateTime(); m_homeTeam = hometeam; m_awayTeam = awayteam; @@ -137,27 +136,29 @@ void Match::setScore(int home, int away, bool notifyWatchers) if (m_homeScore != home) { m_homeScore = home; + if (oldhomescore != -1) { + m_lastHomeGoal = QDateTime::currentDateTime(); + } changed = true; } if (m_awayScore != away) { m_awayScore = away; + if (oldawayscore != -1) { + m_lastAwayGoal = QDateTime::currentDateTime(); + } changed = true; } - if (changed) { - m_lastevent = QDateTime::currentDateTime(); - if(notifyWatchers) { - emit scoreChanged(oldhomescore, oldawayscore, - home, away); - } + if (changed && notifyWatchers) { + emit scoreChanged(oldhomescore, oldawayscore, + home, away); } } void Match::setState(MatchState state, bool notifyWatchers) { if (m_state != state) { m_state = state; - m_lastevent = QDateTime::currentDateTime(); if (notifyWatchers) { emit stateChanged(state); } diff --git a/src/src/match.h b/src/src/match.h index 9a30696..8e84f17 100644 --- a/src/src/match.h +++ b/src/src/match.h @@ -9,7 +9,8 @@ class Match : public QObject { Q_OBJECT Q_PROPERTY(QDateTime date READ date) - Q_PROPERTY(QDateTime lastEvent READ lastEvent) + Q_PROPERTY(QDateTime lastHomeGoal READ lastHomeGoal) + Q_PROPERTY(QDateTime lastAwayGoal READ lastAwayGoal) Q_PROPERTY(QIcon homeEmblem READ homeEmblem) Q_PROPERTY(QIcon awayEmblem READ awayEmblem) Q_PROPERTY(QString homeTeam READ homeTeam) @@ -33,7 +34,8 @@ public: }; private: - QDateTime m_lastevent; + QDateTime m_lastHomeGoal; + QDateTime m_lastAwayGoal; QDateTime m_date; QString m_homeTeam; QString m_awayTeam; @@ -51,7 +53,8 @@ public: explicit Match(QString hometeam, QString awayteam, QDateTime date, QObject *parent = 0); QDateTime date() const {return m_date;} - QDateTime lastEvent() const {return m_lastevent;} + QDateTime lastHomeGoal() const {return m_lastHomeGoal;} + QDateTime lastAwayGoal() const {return m_lastAwayGoal;} QString homeTeam() const {return m_homeTeam;} QString awayTeam() const {return m_awayTeam;} diff --git a/src/src/matchdaymodel.cpp b/src/src/matchdaymodel.cpp index 6ed7de7..0fdedf3 100644 --- a/src/src/matchdaymodel.cpp +++ b/src/src/matchdaymodel.cpp @@ -65,7 +65,7 @@ QVariant MatchDayModel::data(const QModelIndex& index, int role) const break; case Match::FirstHalf: case Match::SecondHalf: - return QIcon(":/bullet-green").pixmap(15,15); + return QIcon(":/football").pixmap(15,15); break; case Match::HalfTime: return QIcon(":/bullet-yellow").pixmap(15,15); @@ -134,7 +134,7 @@ QVariant MatchDayModel::data(const QModelIndex& index, int role) const s.setWidth(120); break; case AwayScore: - s.setWidth(4); + s.setWidth(25); break; case HomeIcon: s.setWidth(29); @@ -143,7 +143,7 @@ QVariant MatchDayModel::data(const QModelIndex& index, int role) const s.setWidth(120); break; case HomeScore: - s.setWidth(4); + s.setWidth(25); break; case Seperator: s.setWidth(5); @@ -168,12 +168,20 @@ QVariant MatchDayModel::data(const QModelIndex& index, int role) const } break; + case Qt::ForegroundRole: + if ((index.column() == HomeScore && + match->lastHomeGoal().secsTo((QDateTime::currentDateTime())) < 300) || + (index.column() == AwayScore && + match->lastAwayGoal().secsTo((QDateTime::currentDateTime())) < 300)) { + return QColor(255, 0, 51); + } + break; + case Qt::FontRole: if ((index.column() == HomeScore || - index.column() == AwayScore) && - (match->lastEvent().secsTo((QDateTime::currentDateTime())) < 300)) { + index.column() == AwayScore)) { f.setBold(true); - f.setPixelSize(16); + f.setPixelSize(20); } else { f.setBold(false); f.setPixelSize(14); -- 1.7.9.5