Skip to content

Commit

Permalink
ECU Info page / seed key calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
Xplatforms committed Oct 6, 2020
1 parent b73fd6d commit a1395cb
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 5 deletions.
77 changes: 76 additions & 1 deletion ECUPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,81 @@ import xplatforms.mbseedkey.ecuseedkeydll 1.0

Page
{
title: qsTr("Select Window")
title: qsTr("SeedKey Calculator / Generator")

property ECUSeedKeyDLL ecu


ColumnLayout
{
anchors.fill: parent
anchors.margins: 15
spacing: 12

RowLayout
{
Layout.fillWidth: true

Label
{
id: dlllabelid
text: qsTr("Selected DLL: ")
font.weight: Font.DemiBold
}

Label
{

Layout.fillWidth: true
text: ecu.DLLName
}
}

RowLayout
{
Layout.fillWidth: true

Label
{
Layout.minimumWidth: dlllabelid.width
text: qsTr("ECU Name: ")
font.weight: Font.DemiBold
}

Label
{

text: ecu.ECUName
}
}

RowLayout
{
Layout.fillWidth: true

Label
{
text: qsTr("Comment: ")
font.weight: Font.DemiBold
}
}

Text
{
Layout.minimumHeight: 60
Layout.fillWidth: true
maximumLineCount: 12
text: ecu.Comment

}




Rectangle
{
Layout.fillHeight: true
}
}

}
8 changes: 6 additions & 2 deletions MainPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import xplatforms.mbseedkey.ecuseedkeydll 1.0
Page
{
title: qsTr("Select Window")
property ExUTILS exutils: ExUTILS{}


function searchFor(text)
{
Expand Down Expand Up @@ -199,7 +199,11 @@ Page
Layout.alignment: Qt.AlignBottom
text: qsTr(" Select this DLL ")

onClicked: stackView.push("ECUPage.qml")
onClicked:
{
// stackView.push("ProfilePage.qml", {"currentprofile": appsettings.getProfileByID(appsettings.defaultProfileID())})
stackView.push("ECUPage.qml", {"ecu": exutils.seedkeydll})
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion ecuseedkeydll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ QString GetLastErrorAsString()
{
//Get the error message, if any.
auto errorMessageID = ::GetLastError();
if(errorMessageID == 0)return QStringLiteral(""); //No error message has been recorded
if(errorMessageID == 0)return QStringLiteral("No error message has been recorded");

LPWSTR messageBuffer = Q_NULLPTR;
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), messageBuffer, 0, NULL);

qDebug() << " Debug errmsg: " << size << errorMessageID;
auto message = QString::fromWCharArray(messageBuffer, size);
if(message.isEmpty())message.append(QString::number(errorMessageID));
LocalFree(messageBuffer);

return message;
Expand Down Expand Up @@ -133,6 +135,8 @@ void ECUSeedKeyDLL::loadDllfuncs()
{
this->setErrorMsg(tr("GenerateKeyExOpt not found in DLL ") + this->p_dllPath);
qWarning() << this->errorMsg();
this->p_ecu_name = tr("not seedkey dll");
emit ECUNameChanged();
return;
}
}
Expand Down
3 changes: 3 additions & 0 deletions exutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ void ExUTILS::loadDllsList(QString search_txt)
QFileInfoList list = dir.entryInfoList(QStringList() << "*.dll", QDir::Files |QDir::NoSymLinks |QDir::NoDotAndDotDot | QDir::Readable, QDir::Name );
for(qint32 x = 0; x < list.count(); x++)
{
this->dlls_list.append(list.at(x).fileName());
/*
auto ecu_test = new ECUSeedKeyDLL(list.at(x).absoluteFilePath());
if(ecu_test->isSeedKeyDll())
{
this->dlls_list.append(ecu_test->DLLName());
qDebug() << "Adding DLL to list: " << ecu_test->DLLName();
}
delete ecu_test;
*/
}
this->p_bak_dlls_list = dlls_list;
emit dllsChanged();
Expand Down
4 changes: 3 additions & 1 deletion main.qml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Dialogs 1.3

import xplatforms.mbseedkey.exutils 1.0

ApplicationWindow
{
Expand All @@ -12,6 +12,8 @@ ApplicationWindow
visible: true
title: qsTr(" Xplatforms / mbseedkey ")

property ExUTILS exutils: ExUTILS{}

FileDialog
{
id: dllselect
Expand Down

0 comments on commit a1395cb

Please sign in to comment.