X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmain-window.cpp;h=ad85c04e31280c2ce7c839a090b200c5eee16e9d;hb=7bf65efa9c1eb3d04e96dd71e50fdfcac446125c;hp=c3c3f0130e5bb7028fac332d515f95c9091b023a;hpb=29696421b73477bde2f00ebe8fc2168c7c11e8ea;p=scorecard diff --git a/src/main-window.cpp b/src/main-window.cpp index c3c3f01..ad85c04 100644 --- a/src/main-window.cpp +++ b/src/main-window.cpp @@ -141,37 +141,52 @@ void MainWindow::flushReadOnlyItems() } } +void MainWindow::markHomeClub() +{ + TRACE; + QListIterator i(clubList); + Club *c; + + while (i.hasNext()) { + c = i.next(); + if (c->getName() == conf.homeClub) + c->setHomeClub(true); + else + c->setHomeClub(false); + } +} MainWindow::MainWindow(QMainWindow *parent): QMainWindow(parent) { - resize(800, 480); + resize(800, 480); #ifdef Q_WS_MAEMO_5 - setAttribute(Qt::WA_Maemo5StackedWindow); + setAttribute(Qt::WA_Maemo5StackedWindow); #endif - loadSettings(); + loadSettings(); - centralWidget = new QWidget(this); + centralWidget = new QWidget(this); - setCentralWidget(centralWidget); + setCentralWidget(centralWidget); - loadScoreFile(scoreFile, scoreList); - if (conf.defaultCourses == "Yes") - loadClubFile(masterFile, clubList, true); - loadClubFile(clubFile, clubList); + loadScoreFile(scoreFile, scoreList); + if (conf.defaultCourses == "Yes") + loadClubFile(masterFile, clubList, true); + loadClubFile(clubFile, clubList); + markHomeClub(); - // Sort the scores based on dates - qSort(scoreList.begin(), scoreList.end(), dateMoreThan); - createActions(); - createMenus(); + // Sort the scores based on dates + qSort(scoreList.begin(), scoreList.end(), dateMoreThan); + createActions(); + createMenus(); - createListView(scoreList, clubList); + createListView(scoreList, clubList); - createLayoutList(centralWidget); + createLayoutList(centralWidget); - scoreWindow = new ScoreWindow(this); - courseWindow = new CourseWindow(this); + scoreWindow = new ScoreWindow(this); + courseWindow = new CourseWindow(this); } void MainWindow::loadSettings(void) @@ -371,6 +386,7 @@ void MainWindow::clickedList(const QModelIndex &index) void MainWindow::viewScore(Score * score, Course * course) { TRACE; + qDebug() << score << course; scoreWindow->setup(score, course); scoreWindow->show(); } @@ -660,8 +676,6 @@ void MainWindow::viewSettings() QString newValue = conf.defaultCourses.toString(); saveSettings(); - qDebug() << "Settings:" << oldValue << "->" << newValue; - // Reload club list, or drop r/o courses from list if (oldValue == "Yes" && newValue == "No") { flushReadOnlyItems(); @@ -673,6 +687,7 @@ void MainWindow::viewSettings() courseListModel->update(clubList); list->update(); } + markHomeClub(); } }