@@ -53,21 +53,24 @@ void DownloaderUI::initParser()
53
53
connect (innerPage, SIGNAL (loadFinished (bool )), SLOT (parse (bool )));// connects with modules code and ID parsing
54
54
connect (innerPage2, SIGNAL (loadFinished (bool )), SLOT (parse2 (bool )));// connects with announcement parsing
55
55
connect (innerPage3, SIGNAL (loadFinished (bool )), SLOT (parse3 (bool )));// connects with exam details parsing
56
- removeTabs ();// removes all the default tabs
56
+ // removeTabs();//removes all the default tabs
57
57
ModulesPageLoader ();// Load announcement modules pages
58
58
poll (); // Timer to poll every 1 hour
59
59
}
60
60
61
61
// Preprocessing that clears default tabs
62
62
void DownloaderUI::removeTabs ()
63
63
{
64
- // qDebug()<<ui->tabWidget_2->count();
65
- ui->tabWidget_2 ->setCurrentIndex (0 );
66
- ui->tabWidget_2 ->removeTab (2 );
67
- ui->tabWidget_2 ->removeTab (1 );
64
+
65
+ // ui->tabWidget_2->setCurrentIndex(0);
66
+ // ui->tabWidget_2->removeTab(2);
67
+ // ui->tabWidget_2->removeTab(1);
68
+ // ui->tabWidget_2->removeTab(0);
69
+ for (int i = ui->tabWidget_2 ->count () - 1 ; i > ui->tabWidget_2 ->currentIndex (); --i) {
70
+ ui->tabWidget_2 ->removeTab (i);
71
+ }
68
72
ui->tabWidget_2 ->removeTab (0 );
69
- // qDebug()<<"Test here";
70
- // qDebug()<<ui->tabWidget_2->count();
73
+
71
74
}
72
75
73
76
// FILES UI
@@ -111,11 +114,12 @@ void DownloaderUI::poll()
111
114
{
112
115
QTimer *timer = new QTimer (this );
113
116
QObject::connect (timer, SIGNAL (timeout ()), this , SLOT (ModulesPageLoader ()));
114
- timer->start (3600000 ); // time specified in ms to poll modulesPageLoader every 1 hour first
117
+ timer->start (3600000 / 2 ); // time specified in ms to poll modulesPageLoader every 1/2 hour first
115
118
}
116
119
117
120
void DownloaderUI::ModulesPageLoader ()
118
121
{
122
+ removeTabs ();
119
123
QString modules=QString (" https://ivle.nus.edu.sg/api/Lapi.svc/Modules?APIKey=%1&AuthToken=%2&Duration=0&IncludeAllInfo=false" ).arg (APIKEY).arg (TOKEN);
120
124
QUrl url2 (modules);
121
125
innerPage->setUrl (url2);
0 commit comments