Updated inventory import to use the newly added LDraw ID.

This commit is contained in:
leozide 2017-09-15 14:52:05 -07:00
parent 39241c8aad
commit ecdcd50239
2 changed files with 5 additions and 2 deletions

View file

@ -977,6 +977,9 @@ bool lcModel::LoadInventory(const QByteArray& Inventory)
{
QJsonObject PartObject = Part.toObject();
QByteArray PartID = PartObject["part"].toObject()["part_num"].toString().toLatin1();
QJsonArray PartIDArray = PartObject["part"].toObject()["external_ids"].toObject()["LDraw"].toArray();
if (!PartIDArray.isEmpty())
PartID = PartIDArray.first().toString().toLatin1();
int Quantity = PartObject["quantity"].toInt();
int ColorCode = 16;
QJsonArray ColorArray = PartObject["color"].toObject()["external_ids"].toObject()["LDraw"].toObject()["ext_ids"].toArray();

View file

@ -72,7 +72,7 @@ void lcSetsDatabaseDialog::accept()
ProgressDialog.show();
int KeyIndex = QTime::currentTime().msec() % mKeys.size();
QString DownloadUrl = QString("http://rebrickable.com/api/v3/lego/sets/%1/parts/?key=%2").arg(SetNum, mKeys[KeyIndex]);
QString DownloadUrl = QString("https://rebrickable.com/api/v3/lego/sets/%1/parts/?key=%2").arg(SetNum, mKeys[KeyIndex]);
mInventoryReply = mNetworkManager.get(QNetworkRequest(QUrl(DownloadUrl)));
@ -133,7 +133,7 @@ void lcSetsDatabaseDialog::on_SearchButton_clicked()
return;
int KeyIndex = QTime::currentTime().msec() % mKeys.size();
QString SearchUrl = QString("http://rebrickable.com/api/v3/lego/sets/?search=%1&key=%2").arg(Keyword, mKeys[KeyIndex]);
QString SearchUrl = QString("https://rebrickable.com/api/v3/lego/sets/?search=%1&key=%2").arg(Keyword, mKeys[KeyIndex]);
mSearchReply = mNetworkManager.get(QNetworkRequest(QUrl(SearchUrl)));