mirror of
https://github.com/Indy970/QtHPConnect
synced 2025-01-18 10:26:35 +01:00
Completed Settings Dialog
This commit is contained in:
parent
703e48de51
commit
4c74f40535
13 changed files with 896 additions and 44 deletions
|
@ -65,7 +65,7 @@ SOURCES += \
|
|||
hp_infodialog.cpp \
|
||||
getnumber.cpp \
|
||||
hpusb.cpp \
|
||||
dlgsettings.cpp
|
||||
hp_settingsdlg.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h \
|
||||
|
@ -102,7 +102,7 @@ HEADERS += \
|
|||
hp_infodialog.h \
|
||||
getnumber.h \
|
||||
hpusb.h \
|
||||
dlgsettings.h
|
||||
hp_settingsdlg.h
|
||||
|
||||
|
||||
FORMS += \
|
||||
|
@ -110,8 +110,8 @@ FORMS += \
|
|||
variableview.ui \
|
||||
hp_mdiwindow.ui \
|
||||
getnumber.ui \
|
||||
dlgsettings.ui \
|
||||
hp_infodialog.ui
|
||||
hp_infodialog.ui \
|
||||
hp_settingsdlg.ui
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../usr/local/lib/release/ -lhpcalcs
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../usr/local/lib/debug/ -lhpcalcs
|
||||
|
|
|
@ -89,14 +89,15 @@ int errorHandler::dump(uint8_t * data, int size)
|
|||
QString text = QString("Dump:\n");
|
||||
QString texta = QString("ASCII:\n");
|
||||
j=0;
|
||||
text = text + QString().sprintf("%04d | ",0);
|
||||
for (i=0; i< size; i++)
|
||||
{
|
||||
|
||||
text = text + QString(" %1 ").arg(QChar(data[i]).unicode(),2,16,QChar('0'));
|
||||
j++;
|
||||
if (j>16) {
|
||||
if (j>15) {
|
||||
j=0;
|
||||
text=text+"\n";
|
||||
text = text + QString().sprintf("%04d | ",i+1);
|
||||
}
|
||||
texta = texta +" "+QChar(data[i]).unicode();
|
||||
|
||||
|
|
|
@ -1,14 +1,107 @@
|
|||
#include "dlgsettings.h"
|
||||
#include "ui_dlgsettings.h"
|
||||
#include "hp_settingsdlg.h"
|
||||
#include "ui_hp_settingsdlg.h"
|
||||
|
||||
dlgSettings::dlgSettings(QWidget *parent) :
|
||||
#include <QDebug>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
hp_SettingsDlg::hp_SettingsDlg(QWidget *parent, hp_Settings * hpset) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::dlgSettings)
|
||||
ui(new Ui::hp_SettingsDlg)
|
||||
{
|
||||
if (hpset) {
|
||||
dlgset=*hpset;
|
||||
retsettings=hpset;
|
||||
}
|
||||
ui->setupUi(this);
|
||||
setupSettings();
|
||||
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(on_clicked(QAbstractButton*)));
|
||||
}
|
||||
|
||||
dlgSettings::~dlgSettings()
|
||||
void hp_SettingsDlg::setupSettings() {
|
||||
ui->cb_angle->setCurrentIndex(dlgset.angle_measure);
|
||||
ui->cb_format->setCurrentIndex(dlgset.number_format);
|
||||
ui->cb_precision->setCurrentIndex(dlgset.precision);
|
||||
ui->cb_grouping->setCurrentIndex(dlgset.digit_grouping);
|
||||
ui->cb_entry->setCurrentIndex(dlgset.entry);
|
||||
ui->cb_integers->setCurrentIndex(dlgset.integers);
|
||||
ui->cb_complex->setCurrentIndex(dlgset.complex);
|
||||
ui->cb_language->setCurrentIndex(dlgset.language);
|
||||
ui->cb_font->setCurrentIndex(dlgset.font_size);
|
||||
ui->cb_theme->setCurrentIndex(dlgset.theme);
|
||||
|
||||
ui->le_integer->setText(QString().sprintf("%d",dlgset.bits));
|
||||
|
||||
if (dlgset.textbook)
|
||||
ui->ch_textbook->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->ch_textbook->setCheckState(Qt::Unchecked);
|
||||
|
||||
if (dlgset.menu)
|
||||
ui->ch_menu->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->ch_menu->setCheckState(Qt::Unchecked);
|
||||
|
||||
if (dlgset.signed_int)
|
||||
ui->ch_signed->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->ch_signed->setCheckState(Qt::Unchecked);
|
||||
|
||||
}
|
||||
|
||||
void hp_SettingsDlg::putSettings() {
|
||||
dlgset.angle_measure=ui->cb_angle->currentIndex();
|
||||
dlgset.number_format=ui->cb_format->currentIndex();
|
||||
dlgset.precision=ui->cb_precision->currentIndex();
|
||||
dlgset.digit_grouping= ui->cb_grouping->currentIndex();
|
||||
dlgset.entry=ui->cb_entry->currentIndex();
|
||||
dlgset.integers=ui->cb_integers->currentIndex();
|
||||
dlgset.complex=ui->cb_complex->currentIndex();
|
||||
dlgset.language=ui->cb_language->currentIndex();
|
||||
dlgset.font_size=ui->cb_font->currentIndex();
|
||||
dlgset.theme=ui->cb_theme->currentIndex();
|
||||
|
||||
dlgset.bits=ui->le_integer->text().toInt();
|
||||
|
||||
if (ui->ch_menu->checkState()==Qt::Checked)
|
||||
dlgset.menu=true;
|
||||
else
|
||||
dlgset.menu=false;
|
||||
|
||||
if (ui->ch_textbook->checkState()==Qt::Checked)
|
||||
dlgset.textbook=true;
|
||||
else
|
||||
dlgset.textbook=false;
|
||||
|
||||
if (ui->ch_signed->checkState()==Qt::Checked)
|
||||
dlgset.signed_int=true;
|
||||
else
|
||||
dlgset.signed_int=false;
|
||||
}
|
||||
|
||||
void hp_SettingsDlg::resetSettings() {
|
||||
hp_Settings newset;
|
||||
dlgset = newset;
|
||||
setupSettings();
|
||||
}
|
||||
|
||||
void hp_SettingsDlg::on_clicked(QAbstractButton * button) {
|
||||
|
||||
if(button==(QAbstractButton*) ui->buttonBox->button(QDialogButtonBox::Reset) ){
|
||||
resetSettings();
|
||||
}
|
||||
if(button==(QAbstractButton*) ui->buttonBox->button(QDialogButtonBox::Ok) ){
|
||||
putSettings();
|
||||
if (retsettings) {
|
||||
*retsettings=dlgset;
|
||||
}
|
||||
close();
|
||||
}
|
||||
if(button==(QAbstractButton*) ui->buttonBox->button(QDialogButtonBox::Cancel) ){
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
hp_SettingsDlg::~hp_SettingsDlg()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
|
|
@ -2,21 +2,31 @@
|
|||
#define DLGSETTINGS_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QAbstractButton>
|
||||
#include "hpdata.h"
|
||||
|
||||
namespace Ui {
|
||||
class dlgSettings;
|
||||
class hp_SettingsDlg;
|
||||
}
|
||||
|
||||
class dlgSettings : public QDialog
|
||||
class hp_SettingsDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
hp_Settings dlgset;
|
||||
hp_Settings * retsettings=nullptr;
|
||||
|
||||
public:
|
||||
explicit dlgSettings(QWidget *parent = 0);
|
||||
~dlgSettings();
|
||||
explicit hp_SettingsDlg(QWidget *parent, hp_Settings * hpset);
|
||||
void setupSettings();
|
||||
void putSettings();
|
||||
~hp_SettingsDlg();
|
||||
|
||||
public slots:
|
||||
void resetSettings();
|
||||
void on_clicked(QAbstractButton *);
|
||||
|
||||
private:
|
||||
Ui::dlgSettings *ui;
|
||||
Ui::hp_SettingsDlg *ui;
|
||||
};
|
||||
|
||||
#endif // DLGSETTINGS_H
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>dlgSettings</class>
|
||||
<widget class="QDialog" name="dlgSettings">
|
||||
<class>hp_SettingsDlg</class>
|
||||
<widget class="QDialog" name="hp_SettingsDlg">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>415</width>
|
||||
<height>372</height>
|
||||
<height>455</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
|
@ -24,32 +27,644 @@
|
|||
</property>
|
||||
<widget class="QWidget" name="hpSettings">
|
||||
<attribute name="title">
|
||||
<string>Settings</string>
|
||||
<string>Home Settings</string>
|
||||
</attribute>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>30</y>
|
||||
<width>58</width>
|
||||
<height>18</height>
|
||||
<x>17</x>
|
||||
<y>20</y>
|
||||
<width>101</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string>Angle Measure:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<widget class="QComboBox" name="cb_angle">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<x>130</x>
|
||||
<y>20</y>
|
||||
<width>83</width>
|
||||
<width>131</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string/>
|
||||
<string>Radians</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Radians</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Degrees</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Gradians</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="ch_signed">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>150</y>
|
||||
<width>41</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>±:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="cb_format">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>50</y>
|
||||
<width>131</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string>Standard</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Standard</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fixed</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Scientific</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Engineering</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Floating</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Rounded</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="cb_grouping">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>81</y>
|
||||
<width>131</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string>123,456.789</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>123,456.789</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>123'456.789</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>123 456.789</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>123456.789</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>123.456,789</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>123'456,789</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>123 456,789</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>123"456.789</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>123456,789</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1234,5678.901</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1,23,456.789</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>101</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number Format:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<width>101</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Digit Grouping:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="cb_entry">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>112</y>
|
||||
<width>131</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string>Textbook</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Textbook</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Algebraic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RPN</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>111</y>
|
||||
<width>101</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Entry:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="cb_integers">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>144</y>
|
||||
<width>131</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string>Binary</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Binary</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Octal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Decimal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Hex</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>143</y>
|
||||
<width>101</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Integers:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>175</y>
|
||||
<width>101</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Complex:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="cb_complex">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>176</y>
|
||||
<width>131</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string>a+b*i</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>a+b*i</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>(a,b)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="cb_language">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>208</y>
|
||||
<width>131</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string>Deutsch</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Deutsch</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>English</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Espanol</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Francais</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Nederlands</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Portugues</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>New Item</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>New Item</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>207</y>
|
||||
<width>101</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Language:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>239</y>
|
||||
<width>101</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Font Size:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="cb_font">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>240</y>
|
||||
<width>131</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string>Small Font</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Small Font</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Medium Font</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Large Font</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="ch_textbook">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>8</x>
|
||||
<y>277</y>
|
||||
<width>141</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Textbook Display:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="ch_menu">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>151</x>
|
||||
<y>277</y>
|
||||
<width>141</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Menu Display:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="cb_theme">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>311</y>
|
||||
<width>131</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string>Light</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Light</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dark</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>310</y>
|
||||
<width>101</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Color Theme:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="cb_precision">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>270</x>
|
||||
<y>50</y>
|
||||
<width>51</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>6</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>7</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>10</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>11</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="le_integer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>266</x>
|
||||
<y>144</y>
|
||||
<width>41</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhDigitsOnly</set>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>32</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -72,7 +687,7 @@
|
|||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>dlgSettings</receiver>
|
||||
<receiver>hp_SettingsDlg</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
|
@ -88,7 +703,7 @@
|
|||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>dlgSettings</receiver>
|
||||
<receiver>hp_SettingsDlg</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
|
|
42
hpdata.cpp
42
hpdata.cpp
|
@ -67,6 +67,45 @@ QString hpCalcData::getName() {
|
|||
return hp_info.name;
|
||||
}
|
||||
|
||||
//get Settings
|
||||
hp_Settings hpCalcData::getSettings() {
|
||||
|
||||
return hp_homesettings;
|
||||
}
|
||||
|
||||
//read Settings via usb
|
||||
void hpCalcData::readSettings() {
|
||||
|
||||
hpusb * api;
|
||||
hp_Handle * handle;
|
||||
hp_Settings hpset;
|
||||
|
||||
log("Reading Settings");
|
||||
qDebug()<<"Reading Settings";
|
||||
api=getAPI();
|
||||
handle=getHandle();
|
||||
|
||||
if (api) {
|
||||
if(handle) {
|
||||
qDebug()<<QString().sprintf("%s %p",__FUNCTION__,handle->usbhandle);
|
||||
if (api) {
|
||||
api->get_settings(handle,&hpset);
|
||||
}
|
||||
}
|
||||
}
|
||||
hp_homesettings=hpset;
|
||||
|
||||
hp_Change change;
|
||||
change.dataChange=HP_MAIN;
|
||||
emit dataChanged(change);
|
||||
}
|
||||
|
||||
//set Settings
|
||||
int hpCalcData::setSettings(hp_Settings set) {
|
||||
|
||||
hp_homesettings=set;
|
||||
}
|
||||
|
||||
void hpCalcData::setInfo(hp_Information dtype) {
|
||||
hp_info=dtype;
|
||||
return;
|
||||
|
@ -94,11 +133,8 @@ void hpCalcData::readInfo() {
|
|||
hp_Change change;
|
||||
change.dataChange=HP_MAIN;
|
||||
emit dataChanged(change);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void hpCalcData::vpkt_send_experiments(int cmd) {
|
||||
|
||||
hpusb * api;
|
||||
|
|
22
hpdata.h
22
hpdata.h
|
@ -25,6 +25,24 @@ struct hp_Information {
|
|||
QString osver="-";
|
||||
};
|
||||
|
||||
struct hp_Settings {
|
||||
int angle_measure=0;
|
||||
int number_format=0;
|
||||
int precision=5;
|
||||
int digit_grouping=0;
|
||||
int entry=2;
|
||||
int integers=3;
|
||||
int bits=32;
|
||||
bool signed_int=false;
|
||||
int complex=0;
|
||||
int language =1;
|
||||
int font_size=2;
|
||||
int theme=1;
|
||||
bool textbook=true;
|
||||
bool menu=false;
|
||||
};
|
||||
|
||||
|
||||
struct hpDataStruct {
|
||||
|
||||
};
|
||||
|
@ -44,6 +62,7 @@ private:
|
|||
hpusb * hp_api;
|
||||
hp_Handle hp_handle;
|
||||
hp_Information hp_info;
|
||||
hp_Settings hp_homesettings;
|
||||
|
||||
public:
|
||||
hpCalcData(hpusb * hpapi);
|
||||
|
@ -52,8 +71,11 @@ public:
|
|||
hpusb * getAPI();
|
||||
void setInfo(hp_Information);
|
||||
void readInfo();
|
||||
void readSettings();
|
||||
hp_Information getInfo();
|
||||
QString getName();
|
||||
hp_Settings getSettings();
|
||||
int setSettings(hp_Settings set);
|
||||
void vpkt_send_experiments(int );
|
||||
|
||||
//public slots:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "hpdata.h"
|
||||
#include "hp_mditexteditor.h"
|
||||
#include "hp_infodialog.h"
|
||||
#include "dlgsettings.h"
|
||||
#include "hp_settingsdlg.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
|
@ -173,23 +173,26 @@ void hpTreeItem::clickAction(QMdiArea * mdiwin) {
|
|||
|
||||
void hpTreeItem::contextAction(QMdiArea * mdiwin, contextActionType cta) {
|
||||
|
||||
dlgSettings * hpsettingsdlg;
|
||||
hp_SettingsDlg * hpsettingsdlg;
|
||||
hp_Information hpinfo;
|
||||
|
||||
hp_Settings hpset;
|
||||
int ret=0;
|
||||
switch (getType()) {
|
||||
case HP_MAIN: {
|
||||
switch (cta) {
|
||||
case CT_PREFERENCE: {
|
||||
hpCalcData * dataStore;
|
||||
dataStore = getDataStore();
|
||||
hpinfo=dataStore->getInfo();
|
||||
hpsettingsdlg = new dlgSettings(mdiwin);
|
||||
hpsettingsdlg->show();
|
||||
dataStore->readSettings();
|
||||
hpset=dataStore->getSettings();
|
||||
hpsettingsdlg = new hp_SettingsDlg(mdiwin, &hpset);
|
||||
ret=hpsettingsdlg->exec();
|
||||
if (ret)
|
||||
dataStore->setSettings(hpset);
|
||||
}
|
||||
break;
|
||||
default: ;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
default: ;
|
||||
|
|
41
hpusb.cpp
41
hpusb.cpp
|
@ -471,6 +471,47 @@ int hpusb::get_info(/*calc_infos * infos*/) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int hpusb::get_settings(hp_Handle * handle, hp_Settings * set) {
|
||||
hp_Settings inset;
|
||||
|
||||
uint8_t transferbuffer[PRIME_RAW_HID_DATA_SIZE ];
|
||||
uint8_t out_buffer[LEN_IN_BUFFER+8];
|
||||
|
||||
hp_pkt_in pktin;
|
||||
hp_pkt_out pktout;
|
||||
|
||||
transferbuffer[0]=0x0;
|
||||
transferbuffer[1]=CMD_PRIME_GET_SETTINGS;
|
||||
|
||||
pktin.buffer=transferbuffer;
|
||||
pktin.size=2;
|
||||
|
||||
pktout.buffer=out_buffer;
|
||||
pktout.size=sizeof(out_buffer);
|
||||
// pktout.size=PRIME_RAW_HID_DATA_SIZE+16;
|
||||
if(!handle) {
|
||||
err(L3,0,"Passed 0 handle");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!submit_sync_transfer(handle,&pktin,&pktout)){
|
||||
}
|
||||
|
||||
inset.entry=1;
|
||||
|
||||
if(set)
|
||||
*set=inset;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hpusb::set_settings(hp_Handle * handle, hp_Settings set) {
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int hpusb::vpkt_send_experiments(hp_Handle * handle, int cmd) {
|
||||
|
||||
uint8_t transferbuffer[PRIME_RAW_HID_DATA_SIZE ];
|
||||
|
|
6
hpusb.h
6
hpusb.h
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <libusb.h>
|
||||
|
||||
struct hp_Settings;
|
||||
|
||||
//! USB Vendor ID of Hewlett-Packard.
|
||||
#define USB_VID_HP (0x03F0)
|
||||
//! USB Product ID of the Prime calculator in firmware revisions < 8151.
|
||||
|
@ -20,6 +22,7 @@
|
|||
#define USB_ENDPOINT_OUT (LIBUSB_ENDPOINT_OUT | 2) /* endpoint address */
|
||||
|
||||
#define CMD_PRIME_CHECK_READY (0xFF)
|
||||
#define CMD_PRIME_GET_SETTINGS (0xF9)
|
||||
#define CMD_PRIME_GET_INFOS (0xFA)
|
||||
#define CMD_PRIME_RECV_SCREEN (0xFC)
|
||||
#define CMD_PRIME_RECV_BACKUP (0xF9)
|
||||
|
@ -102,6 +105,8 @@ class hpusb
|
|||
int is_ready();
|
||||
int load_info(hp_Handle *, hp_Information *);
|
||||
int get_info( /*calc_infos * infos*/);
|
||||
int get_settings(hp_Handle * , hp_Settings * );
|
||||
int set_settings(hp_Handle * , hp_Settings set);
|
||||
|
||||
int vpkt_send_experiments(hp_Handle * handle, int cmd);
|
||||
// Function Prototypes:
|
||||
|
@ -113,7 +118,6 @@ class hpusb
|
|||
friend void cb_in(struct libusb_transfer *transfer);
|
||||
|
||||
~hpusb();
|
||||
|
||||
};
|
||||
|
||||
#endif // HPUSB_H
|
||||
|
|
|
@ -92,6 +92,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
connect(ui->tvCalculators,SIGNAL(clicked(QModelIndex)),this,SLOT(clickedCalculator(QModelIndex)));
|
||||
connect(ui->actionLog,SIGNAL(triggered()),this,SLOT(createLogWindow()));
|
||||
connect(ui->actionTest,SIGNAL(triggered()),this,SLOT(testFunction()));
|
||||
connect(ui->actionTestSettings,SIGNAL(triggered()),this,SLOT(onTestSettings()));
|
||||
connect(ui->tvCalculators, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(on_tvCalculators_customContextMenuRequested(const QPoint &)));
|
||||
|
||||
//default data
|
||||
|
@ -151,7 +152,7 @@ MainWindow::~MainWindow()
|
|||
|
||||
void MainWindow::onOpen()
|
||||
{
|
||||
qDebug()<<"MainWindow::in on OPen";
|
||||
qDebug()<<"MainWindow::in on Open";
|
||||
|
||||
//test to see if data model works
|
||||
hp_Information hpi;
|
||||
|
@ -169,6 +170,21 @@ void MainWindow::onOpen()
|
|||
openHP();
|
||||
}
|
||||
|
||||
void MainWindow::onTestSettings()
|
||||
{
|
||||
qDebug()<<"MainWindow::in test Settings";
|
||||
|
||||
QString key;
|
||||
key=hpTreeModel->getLastDataKey();
|
||||
hpCalcData * hpdata;
|
||||
qDebug()<<"MainWindow:: getKey";
|
||||
|
||||
hpdata=hpTreeModel->getHpCalcData(key);
|
||||
if(hpdata)
|
||||
hpdata->readSettings();
|
||||
}
|
||||
|
||||
|
||||
//Experimental
|
||||
void MainWindow::loadTextFile()
|
||||
{
|
||||
|
@ -191,7 +207,7 @@ void MainWindow::openHP()
|
|||
data=hpTreeModel->getCalculator(name1);
|
||||
if(data) {
|
||||
qDebug()<<"Read Info";
|
||||
data->readInfo();
|
||||
data->readInfo();
|
||||
}
|
||||
else {
|
||||
qDebug()<<"In open Func";
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
|
||||
private slots:
|
||||
void onOpen();
|
||||
void onTestSettings();
|
||||
void selectionChangedSlot(const QItemSelection & /*newSelection*/, const QItemSelection & /*oldSelection*/);
|
||||
void about();
|
||||
void showContent();
|
||||
|
|
|
@ -185,6 +185,7 @@
|
|||
<addaction name="actionOpen"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionTest"/>
|
||||
<addaction name="actionTestSettings"/>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="dwContent_2">
|
||||
<property name="sizePolicy">
|
||||
|
@ -480,6 +481,15 @@
|
|||
<string>TreePreference</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTestSettings">
|
||||
<property name="icon">
|
||||
<iconset resource="qthpconnect.qrc">
|
||||
<normaloff>:/icons/preferences_32x32.png</normaloff>:/icons/preferences_32x32.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TestSettings</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
|
|
Loading…
Reference in a new issue