The main Show Tracker 2 window. More...
#include <showtracker2.h>
Public Slots | |
void | ShowAddDialog () |
Display the add show dialog as a modal dialog. | |
void | AddShow (QString showId) |
Add a show. | |
void | RemoveSelectedShow () |
Remove the currently selected show. | |
void | UpdateShows () |
Update all shows. | |
void | UpdateShowsImages () |
Update all show images. | |
void | DeleteShowXML () |
Delete all show XML. | |
void | DeleteImages () |
Delete all stored images. | |
void | SelectShow (int currentRow, int currentColumn=-1, int previousRow=-1, int previousColumn=-1) |
Display show information, seasons, and select the first show. | |
void | SelectSeason (int currentRow, int currentColumn=-1, int previousRow=-1, int previousColumn=-1) |
Display episodes for the selected season. | |
void | CheckedChanged (QTableWidgetItem *item) |
Handle when a checkbox is checked for an episode. | |
void | LoadData () |
Load and display all show data. | |
Public Member Functions | |
showtracker2 (QWidget *parent=0) | |
Initialises the main window and the add window dialog. | |
~showtracker2 () | |
Saves shows on app close. | |
QString | RandomMirror (QStringList mirrorList) |
Get a random mirror. | |
bool | DownloadFile (QString target, QString destination, bool overwrite=false) |
Download a file. | |
Public Attributes | |
QStringList | mirrorsBanner |
Mirror URLs for banners. | |
QStringList | mirrorsXml |
Mirror URLs for XML. | |
QStringList | mirrorsZip |
Mirror URLs for zip files. | |
QMap< QString, STShow > | shows |
A map of shows. The key is the show ID. | |
Private Member Functions | |
void | LoadMirrors () |
Loads mirrors. | |
void | GetServerTime () |
Get the server time from theTvDb.com. | |
void | LoadShows () |
Load all shows. | |
bool | LoadShow (QString showId) |
Load a show. | |
void | SaveShows () |
Save show information. | |
void | DisplayShows () |
Display all shows. | |
void | DisplayShow (int showNum, QString showId) |
Display an individual show. | |
void | DisplaySeasons (QString showId) |
Display all seasons for a specific show. | |
void | DisplayEpisodes (QString showId, QString seasonId) |
Display all episodes for a specific season. | |
void | UpdateShow (QString showId) |
Update an individual show. | |
void | UpdateShowImages (QString showId) |
Update all images for a specific show. | |
void | DownloadShowBanner (QString showId) |
Download a specific show's banner. | |
void | DownloadShowSeasonBanners (QString showId) |
Download all season banners for a specific show. | |
void | SetItemColour (QTableWidgetItem *item, int days, bool clear=false) |
set the colour of a QTableWidgetItem depending on how the value of the days paramter | |
void | SetSeasonColour (QTableWidgetItem *item, QString showId, QString seasonId) |
Set the colour of a season. | |
void | SetShowColour (QTableWidgetItem *item, QString showId) |
Set the colour of a show. | |
bool | IsEpisodeWatched (QString showId, QString seasonId, QString episodeId) |
Finds out whether an episode has been watched. | |
bool | RecursiveDeleteFolder (QDir dir) |
Deletes folders and contents recursively. | |
Private Attributes | |
Ui::showtracker2Class | ui |
QTimer | timer |
A timer used to let the main window load before loading the data. | |
Config | config |
The configuration. | |
QDateTime | serverTime |
The server time of the last show information request. | |
addshowdialog | dialog |
The add show dialog. | |
QDomDocument | trackedShows |
The XML document containing which shows are being tracked. | |
QMap< int, QPair< QString, QMap< int, QPair< QString, QMap< int, QString > > > > > | orderedShows |
An ordered tree used to get an ID by index. |
The main Show Tracker 2 window.
showtracker2::showtracker2 | ( | QWidget * | parent = 0 |
) |
Initialises the main window and the add window dialog.
Connects SIGNALS and sets icons. A timer is set to call a function after the main window has loaded to prevent a long start-up
showtracker2::~showtracker2 | ( | ) |
Saves shows on app close.
void showtracker2::AddShow | ( | QString | showId | ) | [slot] |
Add a show.
showId | The show ID of the show to add |
void showtracker2::CheckedChanged | ( | QTableWidgetItem * | item | ) | [slot] |
Handle when a checkbox is checked for an episode.
This will store that an episode is watched or no longer watched in the trackedShows variable
item | The cell of the checkbox that was checked |
void showtracker2::DeleteImages | ( | ) | [slot] |
Delete all stored images.
void showtracker2::DeleteShowXML | ( | ) | [slot] |
Delete all show XML.
void showtracker2::DisplayEpisodes | ( | QString | showId, | |
QString | seasonId | |||
) | [private] |
Display all episodes for a specific season.
showId | The show that contains the episodes | |
seasonId | The season that contains all the episodes |
void showtracker2::DisplaySeasons | ( | QString | showId | ) | [private] |
Display all seasons for a specific show.
showId | The ID of the show that contains the seasons being displayed |
void showtracker2::DisplayShow | ( | int | showNum, | |
QString | showId | |||
) | [private] |
Display an individual show.
showNum | The show number being displayed | |
showId | The ID for the show being displayed |
void showtracker2::DisplayShows | ( | ) | [private] |
Display all shows.
bool showtracker2::DownloadFile | ( | QString | target, | |
QString | destination, | |||
bool | overwrite = false | |||
) |
Download a file.
target | Target URL of the file to download | |
destination | The local location where the file will be saved | |
overwrite | Whether to overwrite a file if the destination exists |
void showtracker2::DownloadShowBanner | ( | QString | showId | ) | [private] |
Download a specific show's banner.
showId | The ID of the show |
void showtracker2::DownloadShowSeasonBanners | ( | QString | showId | ) | [private] |
Download all season banners for a specific show.
showId | The ID of the show |
void showtracker2::GetServerTime | ( | ) | [private] |
Get the server time from theTvDb.com.
bool showtracker2::IsEpisodeWatched | ( | QString | showId, | |
QString | seasonId, | |||
QString | episodeId | |||
) | [private] |
Finds out whether an episode has been watched.
showId | The ID of the show | |
seasonId | The ID of the season | |
episodeId | the ID of the episode that is being checked |
void showtracker2::LoadData | ( | ) | [slot] |
Load and display all show data.
Loads config, mirrors, server time, shows, then displays the shows
void showtracker2::LoadMirrors | ( | ) | [private] |
Loads mirrors.
Mirrors are used to separate server requests and bandwidth among many servers
bool showtracker2::LoadShow | ( | QString | showId | ) | [private] |
Load a show.
showId | The show ID of the show to load |
void showtracker2::LoadShows | ( | ) | [private] |
Load all shows.
After loading a show, the show is displayed
QString showtracker2::RandomMirror | ( | QStringList | mirrorList | ) |
Get a random mirror.
mirrorList | The mirror list that contains mirrors to choose from |
bool showtracker2::RecursiveDeleteFolder | ( | QDir | dir | ) | [private] |
Deletes folders and contents recursively.
dir | The directory to delete |
void showtracker2::RemoveSelectedShow | ( | ) | [slot] |
Remove the currently selected show.
void showtracker2::SaveShows | ( | ) | [private] |
void showtracker2::SelectSeason | ( | int | currentRow, | |
int | currentColumn = -1 , |
|||
int | previousRow = -1 , |
|||
int | previousColumn = -1 | |||
) | [slot] |
Display episodes for the selected season.
currentRow | The row of the show that is selected | |
currentColumn | Not used but is required to function as a SLOT | |
previousRow | Not used but is required to function as a SLOT | |
previousColumn | Not used but is required to function as a SLOT |
void showtracker2::SelectShow | ( | int | currentRow, | |
int | currentColumn = -1 , |
|||
int | previousRow = -1 , |
|||
int | previousColumn = -1 | |||
) | [slot] |
Display show information, seasons, and select the first show.
currentRow | The row of the show that is selected | |
currentColumn | Not used but is required to function as a SLOT | |
previousRow | Not used but is required to function as a SLOT | |
previousColumn | Not used but is required to function as a SLOT |
void showtracker2::SetItemColour | ( | QTableWidgetItem * | item, | |
int | days, | |||
bool | clear = false | |||
) | [private] |
set the colour of a QTableWidgetItem depending on how the value of the days paramter
-1 is clear
0 is green
1 is yellow
2-7 is blue
8+ is red
item | The item that will have it's background colour changed | |
days | Days from today | |
clear | Whether the background colour should be transparent |
void showtracker2::SetSeasonColour | ( | QTableWidgetItem * | item, | |
QString | showId, | |||
QString | seasonId | |||
) | [private] |
Set the colour of a season.
item | The item that will have it's background colour changed | |
showId | The ID of the show the season belongs to | |
seasonId | The ID of the season |
void showtracker2::SetShowColour | ( | QTableWidgetItem * | item, | |
QString | showId | |||
) | [private] |
Set the colour of a show.
item | The item that will have it's background colour changed | |
showId | The ID of the show |
void showtracker2::ShowAddDialog | ( | ) | [slot] |
Display the add show dialog as a modal dialog.
void showtracker2::UpdateShow | ( | QString | showId | ) | [private] |
Update an individual show.
showId | The ID of the show to update |
void showtracker2::UpdateShowImages | ( | QString | showId | ) | [private] |
Update all images for a specific show.
void showtracker2::UpdateShows | ( | ) | [slot] |
Update all shows.
void showtracker2::UpdateShowsImages | ( | ) | [slot] |
Update all show images.
Config showtracker2::config [private] |
The configuration.
addshowdialog showtracker2::dialog [private] |
The add show dialog.
QStringList showtracker2::mirrorsBanner |
Mirror URLs for banners.
QStringList showtracker2::mirrorsXml |
Mirror URLs for XML.
QStringList showtracker2::mirrorsZip |
Mirror URLs for zip files.
QMap<int, QPair<QString, QMap<int, QPair<QString, QMap<int, QString> > > > > showtracker2::orderedShows [private] |
An ordered tree used to get an ID by index.
The first level is the show number and a pair containing the show ID and a map to the seasons
The second level is the season number and a pair containing the season ID and a map to the episodes
The third level is the episode number and the episode ID
QDateTime showtracker2::serverTime [private] |
The server time of the last show information request.
QMap<QString, STShow> showtracker2::shows |
A map of shows. The key is the show ID.
QTimer showtracker2::timer [private] |
A timer used to let the main window load before loading the data.
QDomDocument showtracker2::trackedShows [private] |
The XML document containing which shows are being tracked.
The show tags will always exist if the show is being tracked but the season and episode tags will only exist if episodes have been watched
Format:
<shows>
<show id="SHOWID">
<season id="SEASONID">
<episode id="EPISODEID" watched="true">
</episode>
</season>
</show>
</shows>
Ui::showtracker2Class showtracker2::ui [private] |