23 #include "ip2cupdatebox.h"    24 #include "ui_ip2cupdatebox.h"    26 #include "doomseekerfilepaths.h"    29 #include "ip2c/ip2cupdater.h"    31 DClass<IP2CUpdateBox> : 
public Ui::IP2CUpdateBox
    44         connect(d->btnUpdate, SIGNAL( clicked() ), 
this, SLOT( accept() ) );
    45         connect(d->btnCancel, SIGNAL( clicked() ), 
this, SLOT( reject() ) );
    46         d->progressBar->hide();
    49         this->connect(d->ip2cUpdater, SIGNAL(updateNeeded(
int)), SLOT(updateInfo(
int)));
    50         d->ip2cUpdater->needsUpdate(DoomseekerFilePaths::ip2cDatabase());
    55 IP2CUpdateBox::~IP2CUpdateBox()
    59 void IP2CUpdateBox::start()
    61         QString filePath = DoomseekerFilePaths::ip2cDatabase();
    63         d->lblIP2CFileLocation->setText(filePath);
    65         QFileInfo fileInfo(filePath);
    66         if (fileInfo.exists())
    68                 d->lblDatabaseStatus->setText(tr(
"Verifying checksum ..."));
    69                 d->progressBar->show();
    73                 d->lblDatabaseStatus->setText(tr(
"IP2C database file was not found. "    74                                 "Precompiled database will be used. "    75                                 "Use update button if you want to download the newest database."));
    79 void IP2CUpdateBox::updateInfo(
int status)
    81         d->progressBar->hide();
    84         case IP2CUpdater::UpdateNeeded:
    85                 d->lblDatabaseStatus->setText(tr(
"Update required."));
    87         case IP2CUpdater::UpToDate:
    88                 d->lblDatabaseStatus->setText(tr(
"Database is up-to-date."));
    90         case IP2CUpdater::UpdateCheckError:
    91                 d->lblDatabaseStatus->setText(tr(
"Database status check failed. See log for details."));
    94                 d->lblDatabaseStatus->setText(tr(
"Unhandled update check status."));
 IP2CUpdater is responsible for downloading a new version of database from the site.