General Update

This commit is contained in:
Indy970 2019-02-10 20:23:04 +02:00
parent 1ec0a071e6
commit 63e092a530
4 changed files with 28 additions and 24 deletions

View file

@ -13,6 +13,12 @@
<height>126</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>HP Prime Data</string>
</property>
@ -20,6 +26,12 @@
<iconset resource="qthpconnect.qrc">
<normaloff>:/icons/about_32x32.png</normaloff>:/icons/about_32x32.png</iconset>
</property>
<property name="frameShape">
<enum>QFrame::WinPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<widget class="QLabel" name="labelser">
<property name="geometry">
<rect>

View file

@ -108,12 +108,18 @@ void hpTreeItem::clickAction(QMdiArea * mdiwin) {
// test=data(Qt::DisplayRole).toString();
switch (getType()) {
case HP_APP:
hpCalcData * dataStore;
dataStore = getDataStore();
hpinfo=dataStore->getInfo();
hpinfodlg = new hp_infoDialog(hpinfo,0);
hpinfodlg->show();
case HP_MAIN: {
hpCalcData * dataStore;
dataStore = getDataStore();
hpinfo=dataStore->getInfo();
hpinfodlg = new hp_infoDialog(hpinfo,0);
hpinfodlg->move(700,400);
hpinfodlg->show();
}
break;
case HP_APP: {
}
break;
case HP_CAS:
if (hpvaredit==nullptr)
@ -208,15 +214,11 @@ void hpTreeItem::dataChange(hp_Change hpchange) {
hpCalcData * ptr=nullptr;
QString name;
qDebug()<<"In data Change";
switch (hpchange.dataChange) {
case HP_MAIN:
qDebug()<<"test";
ptr=getDataStore();
qDebug()<<"past test";
if (ptr) {
name=ptr->getName();
qDebug()<<"get name";
setData(name,Qt::DisplayRole);
}
break;

View file

@ -174,11 +174,10 @@ int hpusb::submit_sync_transfer(hp_Handle * handle, hp_pkt_in * pktin, hp_pkt_ou
&trans,10000);
log(QString().sprintf("Write Error: %s\n", libusb_error_name(ret)));
log(QString().sprintf("Write bytes: %d\n", trans));
//read
log("Recieve...");
log("Recieve...");
ret = libusb_interrupt_transfer(devh,0x81,pktout->buffer,pktout->size-8,&trans,10000);
log(QString().sprintf("read: %d\n", trans));
@ -401,25 +400,16 @@ int hpusb::load_info(hp_Handle * handle, hp_Information * hpinfo) {
log("unpacking data");
int ind=0;
qDebug()<<"start";
QTextCodec * codec = QTextCodec::codecForName("UTF-8");
QByteArray rd= QByteArray(reinterpret_cast<const char*>(pktout.buffer), pktout.size);
//find name
ind=rd.indexOf(QChar(0x6c),0)+1;
QByteArray str1 =rd.mid(ind,64);
qDebug()<<ind;
qDebug()<<str1.at(0);
qDebug()<<str1.at(1);
// qDebug()<<rd;
QString name;
name = codec->toUnicode(str1);
hpinfo->name=name;
qDebug()<<name;
log("the name is ...")
log(name);
//find OS Version
unsigned char searchstr[] = {0x80,0x20,0x80,0x01,0x62,0x01};
@ -439,7 +429,6 @@ int hpusb::load_info(hp_Handle * handle, hp_Information * hpinfo) {
QString serial;
serial = codec->toUnicode(str1);
hpinfo->serialnum=serial;
qDebug()<<serial;
log(serial);
//find Application Version
@ -448,10 +437,8 @@ int hpusb::load_info(hp_Handle * handle, hp_Information * hpinfo) {
QString app;
app = codec->toUnicode(str1);
//hpinfo->appver=app;
qDebug()<<app;
log(app);
//
return 0;
}
else {

View file

@ -21,6 +21,9 @@ int treeModel::addCalculator(QString name, hpusb * handle){
hpDataLink hplink;
hpCalcData * hpData = new hpCalcData(handle);
hpTreeItem * hpCalc = new hpTreeItem(name,hpData,0);
hpCalc->setType(HP_MAIN);
hpCalc->setIcon(QIcon(":/icons/monitor_32x32.png"));
hpCalc->setToolTip(QString("Calculator contents"));
QObject::connect(hpData, SIGNAL(dataChanged(hp_Change)),hpCalc, SLOT(dataChange(hp_Change)));
setHpCalcData(name,hpData,hpCalc);
rootNode->appendRow(hpCalc);