23 #include "ip2cupdatebox.h"
24 #include "ui_ip2cupdatebox.h"
26 #include "doomseekerfilepaths.h"
28 #include "ip2c/ip2cupdater.h"
32 DClass<IP2CUpdateBox> :
public Ui::IP2CUpdateBox
45 connect(d->btnUpdate, SIGNAL(clicked()),
this, SLOT(accept()));
46 connect(d->btnCancel, SIGNAL(clicked()),
this, SLOT(reject()));
47 d->progressBar->hide();
50 this->connect(d->ip2cUpdater, SIGNAL(updateNeeded(
int)), SLOT(updateInfo(
int)));
55 IP2CUpdateBox::~IP2CUpdateBox()
59 void IP2CUpdateBox::start()
63 d->lblIP2CFileLocation->setText(!filePath.isEmpty() ? filePath : tr(
"N/A"));
66 d->lblIP2CDownloadLocation->setText(downloadPath);
67 QFileInfo downloadedFileInfo(downloadPath);
68 d->lblDownloadIcon->setPixmap(downloadedFileInfo.isFile() ?
69 QPixmap(
":/icons/edit-redo.png") :
70 QPixmap(
":/icons/edit-redo-red.png"));
71 d->lblDownloadIcon->setToolTip(downloadedFileInfo.isFile() ?
72 tr(
"File is already downloaded.") :
73 tr(
"File doesn't exist yet or location doesn't point to a file."));
75 QFileInfo fileInfo(filePath);
76 if (!filePath.isEmpty() && fileInfo.exists())
78 d->lblFileIcon->setPixmap(QPixmap(
":/icons/edit-redo.png"));
79 d->lblDatabaseStatus->setText(tr(
"Verifying checksum ..."));
80 d->progressBar->show();
81 d->ip2cUpdater->needsUpdate(filePath);
85 d->lblFileIcon->setPixmap(QPixmap(
":/icons/edit-redo-red.png"));
86 d->lblDatabaseStatus->setText(tr(
"IP2C database file was not found. "
87 "Use the update button if you want to download the newest database."));
91 void IP2CUpdateBox::updateInfo(
int status)
93 d->progressBar->hide();
96 case IP2CUpdater::UpdateNeeded:
97 d->lblStatusIcon->setPixmap(QPixmap(
":/icons/edit-redo-red.png"));
98 d->lblDatabaseStatus->setText(tr(
"Update required."));
100 case IP2CUpdater::UpToDate:
101 d->lblStatusIcon->setPixmap(QPixmap(
":/icons/edit-redo.png"));
102 d->lblDatabaseStatus->setText(tr(
"Database is up-to-date."));
104 case IP2CUpdater::UpdateCheckError:
105 d->lblStatusIcon->setPixmap(QPixmap(
":/icons/x.png"));
106 d->lblDatabaseStatus->setText(tr(
"Database status check failed. See log for details."));
109 d->lblStatusIcon->setPixmap(QPixmap(
":/icons/x.png"));
110 d->lblDatabaseStatus->setText(tr(
"Unhandled update check status."));