23 #include "ip2cupdatebox.h"
24 #include "ui_ip2cupdatebox.h"
26 #include "doomseekerfilepaths.h"
27 #include "gui/commongui.h"
29 #include "ip2c/ip2cupdater.h"
33 DClass<IP2CUpdateBox> :
public Ui::IP2CUpdateBox
47 connect(d->btnUpdate, SIGNAL(clicked()),
this, SLOT(accept()));
48 connect(d->btnCancel, SIGNAL(clicked()),
this, SLOT(reject()));
49 d->progressBar->hide();
52 this->connect(d->ip2cUpdater, SIGNAL(updateNeeded(
int)), SLOT(updateInfo(
int)));
57 IP2CUpdateBox::~IP2CUpdateBox()
61 void IP2CUpdateBox::start()
65 d->lblIP2CFileLocation->setText(!filePath.isEmpty() ? filePath : tr(
"N/A"));
68 d->lblIP2CDownloadLocation->setText(downloadPath);
69 QFileInfo downloadedFileInfo(downloadPath);
70 d->lblDownloadIcon->setPixmap(downloadedFileInfo.isFile() ?
71 QPixmap(
":/icons/edit-redo.png") :
72 QPixmap(
":/icons/edit-redo-red.png"));
73 d->lblDownloadIcon->setToolTip(downloadedFileInfo.isFile() ?
74 tr(
"File is already downloaded.") :
75 tr(
"File doesn't exist yet or location doesn't point to a file."));
77 QFileInfo fileInfo(filePath);
78 if (!filePath.isEmpty() && fileInfo.exists())
80 d->lblFileIcon->setPixmap(QPixmap(
":/icons/edit-redo.png"));
81 d->lblDatabaseStatus->setText(tr(
"Verifying checksum ..."));
82 d->progressBar->show();
83 d->ip2cUpdater->needsUpdate(filePath);
87 d->lblFileIcon->setPixmap(QPixmap(
":/icons/edit-redo-red.png"));
88 d->lblDatabaseStatus->setText(tr(
"IP2C database file was not found. "
89 "Use the update button if you want to download the newest database."));
93 void IP2CUpdateBox::updateInfo(
int status)
95 d->progressBar->hide();
98 case IP2CUpdater::UpdateNeeded:
99 d->lblStatusIcon->setPixmap(QPixmap(
":/icons/edit-redo-red.png"));
100 d->lblDatabaseStatus->setText(tr(
"Update required."));
102 case IP2CUpdater::UpToDate:
103 d->lblStatusIcon->setPixmap(QPixmap(
":/icons/edit-redo.png"));
104 d->lblDatabaseStatus->setText(tr(
"Database is up-to-date."));
106 case IP2CUpdater::UpdateCheckError:
107 d->lblStatusIcon->setPixmap(QPixmap(
":/icons/x.png"));
108 d->lblDatabaseStatus->setText(tr(
"Database status check failed. See log for details."));
111 d->lblStatusIcon->setPixmap(QPixmap(
":/icons/x.png"));
112 d->lblDatabaseStatus->setText(tr(
"Unhandled update check status."));