added name updating while window open
This commit is contained in:
parent
49d29aa3ec
commit
4334537966
5 changed files with 41 additions and 7 deletions
|
@ -46,7 +46,7 @@ void DatabaseThread::run()
|
||||||
QString memberListUrl = "http://socialclub.rockstargames.com/crewsapi/GetMembersList?crewId=" + crewID;
|
QString memberListUrl = "http://socialclub.rockstargames.com/crewsapi/GetMembersList?crewId=" + crewID;
|
||||||
|
|
||||||
QNetworkRequest netRequest(memberListUrl);
|
QNetworkRequest netRequest(memberListUrl);
|
||||||
netRequest.setRawHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:45.0) Gecko/20100101 Firefox/45.0");
|
netRequest.setRawHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:45.0) Gecko/20100101 Firefox/45.0 gta5sync/1.0");
|
||||||
netRequest.setRawHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
netRequest.setRawHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
||||||
netRequest.setRawHeader("Accept-Language", "en-US;q=0.5,en;q=0.3");
|
netRequest.setRawHeader("Accept-Language", "en-US;q=0.5,en;q=0.3");
|
||||||
netRequest.setRawHeader("Connection", "keep-alive");
|
netRequest.setRawHeader("Connection", "keep-alive");
|
||||||
|
@ -84,6 +84,8 @@ void DatabaseThread::run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit playerNameUpdated();
|
||||||
|
|
||||||
QTimer::singleShot(300000, &threadLoop, SLOT(quit()));
|
QTimer::singleShot(300000, &threadLoop, SLOT(quit()));
|
||||||
threadLoop.exec();
|
threadLoop.exec();
|
||||||
goto dbtBegin;
|
goto dbtBegin;
|
||||||
|
|
|
@ -37,6 +37,7 @@ protected:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void playerNameFound(int playerID, QString playerName);
|
void playerNameFound(int playerID, QString playerName);
|
||||||
|
void playerNameUpdated();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,11 @@ PictureDialog::PictureDialog(ProfileDatabase *profileDB, QWidget *parent) :
|
||||||
ui->cmdExport->setDefault(0);
|
ui->cmdExport->setDefault(0);
|
||||||
ui->cmdClose->setDefault(1);
|
ui->cmdClose->setDefault(1);
|
||||||
ui->cmdClose->setFocus();
|
ui->cmdClose->setFocus();
|
||||||
|
plyrsList = QStringList();
|
||||||
|
crewID = "";
|
||||||
|
locX = "";
|
||||||
|
locY = "";
|
||||||
|
locZ = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
PictureDialog::~PictureDialog()
|
PictureDialog::~PictureDialog()
|
||||||
|
@ -62,11 +67,11 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk)
|
||||||
}
|
}
|
||||||
if (picture->isJsonOk())
|
if (picture->isJsonOk())
|
||||||
{
|
{
|
||||||
QString locX = QString::number(picture->getLocationX());
|
locX = QString::number(picture->getLocationX());
|
||||||
QString locY = QString::number(picture->getLocationY());
|
locY = QString::number(picture->getLocationY());
|
||||||
QString locZ = QString::number(picture->getLocationZ());
|
locZ = QString::number(picture->getLocationZ());
|
||||||
QString crewID = QString::number(picture->getCrewNumber());
|
crewID = QString::number(picture->getCrewNumber());
|
||||||
QStringList plyrsList = picture->getPlayers();
|
plyrsList = picture->getPlayers();
|
||||||
|
|
||||||
QString plyrsStr;
|
QString plyrsStr;
|
||||||
if (plyrsList.length() >= 1)
|
if (plyrsList.length() >= 1)
|
||||||
|
@ -95,6 +100,21 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PictureDialog::on_playerNameUpdated()
|
||||||
|
{
|
||||||
|
if (plyrsList.count() >= 1)
|
||||||
|
{
|
||||||
|
QString plyrsStr;
|
||||||
|
foreach (const QString &player, plyrsList)
|
||||||
|
{
|
||||||
|
plyrsStr.append(", ");
|
||||||
|
plyrsStr.append(profileDB->getPlayerName(player.toInt()));
|
||||||
|
}
|
||||||
|
plyrsStr.remove(0,2);
|
||||||
|
ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, plyrsStr, crewID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PictureDialog::on_cmdClose_clicked()
|
void PictureDialog::on_cmdClose_clicked()
|
||||||
{
|
{
|
||||||
this->close();
|
this->close();
|
||||||
|
|
|
@ -35,15 +35,23 @@ public:
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk);
|
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk);
|
||||||
~PictureDialog();
|
~PictureDialog();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void on_playerNameUpdated();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_cmdClose_clicked();
|
void on_cmdClose_clicked();
|
||||||
void on_cmdExport_clicked();
|
void on_cmdExport_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::PictureDialog *ui;
|
Ui::PictureDialog *ui;
|
||||||
|
ProfileDatabase *profileDB;
|
||||||
QString jsonDrawString;
|
QString jsonDrawString;
|
||||||
QString windowTitleStr;
|
QString windowTitleStr;
|
||||||
ProfileDatabase *profileDB;
|
QStringList plyrsList;
|
||||||
|
QString crewID;
|
||||||
|
QString locX;
|
||||||
|
QString locY;
|
||||||
|
QString locZ;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PICTUREDIALOG_H
|
#endif // PICTUREDIALOG_H
|
||||||
|
|
3
main.cpp
3
main.cpp
|
@ -71,9 +71,12 @@ int main(int argc, char *argv[])
|
||||||
bool readOk = picture.readingPictureFromFile(arg1);
|
bool readOk = picture.readingPictureFromFile(arg1);
|
||||||
picDialog->setWindowFlags(picDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
|
picDialog->setWindowFlags(picDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||||
picDialog->setSnapmaticPicture(&picture, readOk);
|
picDialog->setSnapmaticPicture(&picture, readOk);
|
||||||
|
|
||||||
int crewID = picture.getCrewNumber();
|
int crewID = picture.getCrewNumber();
|
||||||
if (crewID != 0) { crewDB->addCrew(crewID); }
|
if (crewID != 0) { crewDB->addCrew(crewID); }
|
||||||
if (!readOk) { return 1; }
|
if (!readOk) { return 1; }
|
||||||
|
|
||||||
|
QObject::connect(threadDB, SIGNAL(playerNameUpdated()), picDialog, SLOT(on_playerNameUpdated()));
|
||||||
picDialog->show();
|
picDialog->show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
|
Loading…
Reference in a new issue