#include "mainwindow.h"
#include <QApplication>
#include <QDebug>
#include <QDesktopWidget>
#include <QFileInfo>
#include <QHBoxLayout>
#include <QStandardPaths>
#include <QToolBar>
#include <QVBoxLayout>
#define USERDATA_SETTING_CFG "/userdata/setting.cfg"
#define HOME_SETTING_CFG QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/setting.cfg"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
// 包含this窗口全屏显示
const QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
resize(availableGeometry.width(), availableGeometry.height());
setMinimumWidth(availableGeometry.width());
audio = nullptr;
wifi = nullptr;
bt = nullptr;
update = nullptr;
factoryReset = nullptr;
getConfig();
returnBtn.setStyleSheet(tr("border-image: url(:/return.png);"));
QPixmap pixmap(":/return.png");
returnBtn.setFixedSize(pixmap.width(), pixmap.height());
QFont font;
title.setText("Setting");
font.setPixelSize(availableGeometry.height()/20);
title.setFont(font);
title.setAlignment(Qt::AlignLeft);
QHBoxLayout *hlayout = new QHBoxLayout;
hlayout->addWidget(&returnBtn);
hlayout->addWidget(&title);
hlayout->addWidget(&subTitle);
hlayout->addWidget(&toggleBtn);
font.setPixelSize(pixmap.height()*1/3);
subTitle.setFont(font);
subTitle.setAlignment(Qt::AlignCenter);
subTitle.setVisible(false);
font.setPixelSize(pixmap.height()/2);
toggleBtn.setFont(font);
toggleBtn.setFixedSize(pixmap.width(), pixmap.height());
toggleBtn.setVisible(false);
font.setPixelSize(availableGeometry.height()/20);
// QListWidgetItem *audio = new QListWidgetItem(tr("Audio"), &listWidget);
// audio->setFont(font);
QListWidgetItem *wifi = new QListWidgetItem(tr("WiFi"), &listWidget);
wifi->setFont(font);
QListWidgetItem *bt = new QListWidgetItem(tr("BT"), &listWidget);
bt->setFont(font);
QListWidgetItem *update = new QListWidgetItem(tr("Update"), &listWidget);
update->setFont(font);
QListWidgetItem *factory = new QListWidgetItem(tr("Factory Reset"), &listWidget);
factory->setFont(font);
listWidget.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
listWidget.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
stack.addWidget(&listWidget);
stack.setCurrentIndex(0);
QWidget *hWidget = new QWidget;
hWidget->setLayout(hlayout);
QVBoxLayout *vlayout = new QVBoxLayout;
vlayout->addWidget(hWidget);
vlayout->addWidget(&stack);
QWidget *vWidget = new QWidget;
vWidget->setLayout(vlayout);
setCentralWidget(vWidget);
setStyleSheet("background-color:rgb(204,228,247)");
setWindowState(Qt::WindowMaximized);
setWindowFlags(Qt::FramelessWindowHint);
connect(&listWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(on_itemClicked(QListWidgetItem *)));
connect(&returnBtn, SIGNAL(clicked(bool)), this, SLOT(on_returnClicked()));
}
MainWindow::~MainWindow()
{
}
QString MainWindow::saveConfig(int volume, int wifi, int bt)
{
QString path;
QFileInfo fi("/userdata");
if(fi.isDir()){
path = USERDATA_SETTING_CFG;
}else {
path = HOME_SETTING_CFG;
}
QFile file(path);
if(! file.open(QIODevice::ReadWrite | QIODevice::Text)){
qDebug() << "open rw setting.cfg failed";
return nullptr;
}
QTextStream out(&file);
out << "volume = " + QString::number(volume) << endl;
out << "isWifiOn = " + QString::number(wifi) << endl;
out << "isBtOn = " + QString::number(bt) << endl;
out.flush();
file.close();
return path;
}
int MainWindow::getValue(QTextStream *in, QString text)
{
in->seek(0);
do {
QString temp = in->readLine();
if(temp.startsWith(text)){
int size = text.count();
QString result = temp.mid(size, temp.count());
return result.toInt();
}
}while (! in->atEnd());
return -1;
}
void MainWindow::getConfig()
{
QString path;
if(QFile::exists(USERDATA_SETTING_CFG)){
path = USERDATA_SETTING_CFG;
}else if(QFile::exists(HOME_SETTING_CFG)){
path = HOME_SETTING_CFG;
}else {
path = saveConfig(100, 0, 0);
}
QFile file(path);
if(! file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug() << "open ro setting.cfg failed";
return;
}
QTextStream in(&file);
volume = getValue(&in, "volume = ");
isWifiOn = getValue(&in, "isWifiOn = ");
isBtOn = getValue(&in, "isBtOn = ");
}
void MainWindow::on_itemClicked(QListWidgetItem *item)
{
title.setText(item->text());
if(! item->text().compare("Audio")){
audio = new qtAudio(this);
stack.addWidget(audio);
stack.setCurrentIndex(stack.indexOf(audio));
} else if(! item->text().compare("WiFi")){
wifi = qtWifi::getInstance(this, &subTitle, &toggleBtn, isWifiOn);
stack.addWidget(wifi);
stack.setCurrentIndex(stack.indexOf(wifi));
} else if(! item->text().compare("BT")){
bt = qtBT::getInstance(this, &subTitle, &toggleBtn, isBtOn);
stack.addWidget(bt);
stack.setCurrentIndex(stack.indexOf(bt));
} else if(! item->text().compare("Update")){
update = new qtUpdate(this);
stack.addWidget(update);
stack.setCurrentIndex(stack.indexOf(update));
} else if(! item->text().compare("Factory Reset")){
factoryReset = new qtFactoryReset(this);
stack.addWidget(factoryReset);
stack.setCurrentIndex(stack.indexOf(factoryReset));
}
}
void MainWindow::on_returnClicked()
{
if(title.text() == "Setting"){
if(bt){
isBtOn = bt->isOn();
delete bt;
bt = nullptr;
}
saveConfig(volume, isWifiOn, isBtOn);
qApp->exit(0);
}else {
title.setText("Setting");
if(audio){
stack.removeWidget(audio);
delete audio;
audio = nullptr;
}else if(wifi){
stack.removeWidget(wifi);
isWifiOn = wifi->isOn();
delete wifi;
wifi = nullptr;
}else if(bt){
stack.removeWidget(bt);
isBtOn = bt->isOn();
delete bt;
bt = nullptr;
}else if(update){
stack.removeWidget(update);
delete update;
update = nullptr;
}else if(factoryReset){
stack.removeWidget(factoryReset);
delete factoryReset;
factoryReset = nullptr;
}
stack.setCurrentIndex(stack.indexOf(&listWidget));
}
}
#include "qtaudio.h"
#include <QApplication>
#include <QAudioDeviceInfo>
#include <QAudioOutput>
#include <QDebug>
#include <QDesktopWidget>
qtAudio::qtAudio(QWidget *parent)
{
const QRect availableGeometry = QApplication::desktop()->availableGeometry(parent);
resize(availableGeometry.width(), availableGeometry.height());
QFont f;
f.setPixelSize(availableGeometry.height()/20);
listWidget = new QListWidget();
QList<QAudioDeviceInfo> alist = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
QAudioDeviceInfo defaultinfo(QAudioDeviceInfo::defaultOutputDevice());
qDebug() << "default device name: " << defaultinfo.deviceName();
for(auto info : alist){
QListWidgetItem *audioItem = new QListWidgetItem();
audioItem->setText(info.deviceName());
audioItem->setFont(f);
audioItem->setFlags(audioItem->flags() | Qt::ItemIsUserCheckable);
if(defaultinfo == info){
audioItem->setCheckState(Qt::Checked);
} else {
audioItem->setCheckState(Qt::Unchecked);
}
qDebug() << info.deviceName();
listWidget->addItem(audioItem);
}
listWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
listWidget->setMinimumHeight(listWidget->sizeHintForRow(0) * listWidget->count());
listWidget->setMaximumHeight(listWidget->sizeHintForRow(0) * listWidget->count());
slider = new QSlider(Qt::Horizontal);
slider->setMinimum(0);
slider->setMaximum(10);
QAudioOutput out(defaultinfo);
qreal v = out.volume();
slider->setValue(qRound(v*10));
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(changeVolume(int)));
vLayout = new QVBoxLayout();
vLayout->addWidget(listWidget);
vLayout->addWidget(slider);
vLayout->setAlignment(Qt::AlignTop);
setLayout(vLayout);
setStyleSheet("background-color:rgb(204,228,247)");
setObjectName("Audio");
connect(listWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(on_itemClicked(QListWidgetItem *)));
}
qtAudio::~qtAudio()
{
listWidget->clear();
delete listWidget;
delete slider;
delete vLayout;
}
void qtAudio::on_itemClicked(QListWidgetItem *item)
{
qDebug() << item->text();
}
void qtAudio::changeVolume(int value)
{
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
QAudioOutput out(info);
qreal linearVolume = QAudio::convertVolume(value / qreal(100.0),
QAudio::LinearVolumeScale,
QAudio::LogarithmicVolumeScale);
qDebug() << value;
qreal v = qreal(value) / qreal(10.0);
qDebug() << v;
out.setVolume(v);
QApplication::beep();
}
#include <QApplication>
#include <QDesktopWidget>
#include <QFile>
#include <QProcess>
#include "qtbt.h"
#include <unistd.h>
#include <sys/prctl.h>
qtBT* qtBT::_instance = nullptr;
void qtBT::state_cb(RK_BT_STATE state)
{
switch(state) {
case RK_BT_STATE_TURNING_ON:
qDebug() << "RK_BT_STATE_TURNING_ON";
break;
case RK_BT_STATE_ON:
qDebug() << "RK_BT_STATE_ON";
qDebug() << "RK_START_SCAN 10s";
#ifdef RKWIFIBTAPP
rk_bt_start_discovery(10000, SCAN_TYPE_BREDR);
rk_bt_source_open();
#endif
break;
case RK_BT_STATE_TURNING_OFF:
qDebug() << "RK_BT_STATE_TURNING_OFF";
break;
case RK_BT_STATE_OFF:
qDebug() << "RK_BT_STATE_OFF";
break;
}
}
void qtBT::bond_cb(const char *bd_addr, const char *name, RK_BT_BOND_STATE state)
{
switch(state) {
case RK_BT_BOND_STATE_NONE:
case RK_BT_BOND_STATE_BONDING:
break;
case RK_BT_BOND_STATE_BONDED:
break;
}
}
void qtBT::scan_status_cb(RK_BT_DISCOVERY_STATE status)
{
switch(status) {
case RK_BT_DISC_STARTED:
case RK_BT_DISC_START_FAILED:
case RK_BT_DISC_STOPPED_BY_USER:
break;
case RK_BT_DISC_STOPPED_AUTO:
#ifdef RKWIFIBTAPP
rk_bt_start_discovery(10000, SCAN_TYPE_BREDR);
#endif
break;
}
}
void qtBT::source_connect_cb(void *userdata, const char *bd_addr, const char *name, const RK_BT_SOURCE_EVENT enEvent)
{
qtBT *btlist = getInstance();
switch(enEvent)
{
case BT_SOURCE_EVENT_CONNECT_FAILED:
qDebug() << "BT_SOURCE_EVENT_CONNECT_FAILED" << name << bd_addr;
break;
case BT_SOURCE_EVENT_CONNECTED:
qDebug() << "BT_SOURCE_EVENT_CONNECTED" << name << bd_addr;
for(int i=0; i<btlist->count(); i++){
QListWidgetItem *ii = btlist->item(i);
QString str = ii->text();
QStringList sl = str.split(" ");
QString addr = sl.at(1);
QString name = sl.at(2);
if(!addr.isEmpty() && !addr.compare(QString(bd_addr))){
QString str = "Connected " + QString(bd_addr) + " " + QString(name);
QListWidgetItem *iitem = btlist->takeItem(i);
iitem->setText(str);
btlist->insertItem(0, iitem);
return;
}
}
break;
case BT_SOURCE_EVENT_DISCONNECTED:
qDebug() << "BT_SOURCE_EVENT_DISCONNECTED" << name << bd_addr;
for(int i=0; i<btlist->count(); i++){
QListWidgetItem *ii = btlist->item(i);
QString str = ii->text();
QStringList sl = str.split(" ");
QString addr = sl.at(1);
QString name = sl.at(2);
if(!addr.isEmpty() && !addr.compare(QString(bd_addr))){
QString str = "Paired " + QString(bd_addr) + " " + QString(name);
QListWidgetItem *iitem = btlist->takeItem(i);
iitem->setText(str);
btlist->insertItem(0, iitem);
return;
}
}
break;
case BT_SOURCE_EVENT_RC_PLAY:
case BT_SOURCE_EVENT_RC_STOP:
case BT_SOURCE_EVENT_RC_PAUSE:
case BT_SOURCE_EVENT_RC_FORWARD:
case BT_SOURCE_EVENT_RC_BACKWARD:
case BT_SOURCE_EVENT_RC_VOL_UP:
case BT_SOURCE_EVENT_RC_VOL_DOWN:
qDebug() << "BT_SOURCE_EVENT_RC: " << BT_SOURCE_EVENT_RC_VOL_DOWN << name << bd_addr;
break;
}
}
void qtBT::scan_cb(const char *address,const char *name, unsigned int bt_class, int rssi, int change)
{
struct bt_dev_info *dev = new bt_dev_info;
qtBT *btlist = getInstance();
dev->address = address;
dev->name = name;
dev->bt_class = bt_class;
dev->rssi = rssi;
btlist->dev_list.append(dev);
// qDebug() << "address: " << address << "name: " << name << "get name: " << dev->name;
for(int i=0; i<btlist->count(); i++){
QListWidgetItem *ii = btlist->item(i);
QString str = ii->text();
QStringList sl = str.split(" ");
QString addr = sl.at(1);
QString name = sl.at(2);
if(!addr.isEmpty() && !addr.compare(QString(dev->address))){
return;
}
}
if(dev->address){
QString str = "Unpaired " + QString(dev->address) + " " + QString(dev->name);
btlist->addItem(new QListWidgetItem(str, btlist));
}
}
void qtBT::open()
{
qDebug() << "bt open";
#ifdef RKWIFIBTAPP
int count;
RkBtScanedDevice *dev = NULL;
static RkBtScanedDevice *g_dev_list_test;
memset(&bt_content, 0, sizeof(RkBtContent));
bt_content.bt_name = "Rockchip Linux BT";
bt_content.bt_addr = "11:22:33:44:55:66";
rk_bt_register_state_callback(qtBT::state_cb);
rk_bt_register_bond_callback(qtBT::bond_cb);
rk_bt_register_discovery_callback(qtBT::scan_status_cb);
rk_bt_register_dev_found_callback(qtBT::scan_cb);
rk_bt_source_register_status_cb(NULL, source_connect_cb);
if (rk_bt_init(&bt_content) < 0) {
qDebug() << "rk_bt_init error";
return;
}
rk_bt_set_device_name("Rockchip Linux BT");
rk_bt_enable_reconnect(0);
//rk_bt_source_open();
rk_bt_get_paired_devices(&g_dev_list_test, &count);
qDebug() << "current paired devices count: " << count;
dev = g_dev_list_test;
for(int i = 0; i < count; i++) {
qDebug() << i << ": " << dev->remote_address << " " << dev->remote_name << " is_connected: " << dev->is_connected;
QString str;
if(dev->is_connected)
str += "Connected ";
else
str += "Paired ";
str += QString(dev->remote_address) + " " + QString(dev->remote_name);
addItem(new QListWidgetItem(str, this));
dev = dev->next;
}
rk_bt_free_paired_devices(g_dev_list_test);
g_dev_list_test = NULL;
rk_bt_start_discovery(10000, SCAN_TYPE_BREDR);
#endif
}
void qtBT::close()
{
qDebug() << "bt close";
#ifdef RKWIFIBTAPP
//rk_bt_cancel_discovery();
rk_bt_deinit();
#endif
}
qtBT::qtBT(QWidget *parent, QLabel *label, QPushButton *btn, bool on)
{
const QRect availableGeometry = QApplication::desktop()->availableGeometry(parent);
resize(availableGeometry.width(), availableGeometry.height());
QFont font;
font.setPixelSize(availableGeometry.height()/40);
if(btn){
switchBtn = btn;
switchBtn->setCheckable(true);
switchBtn->setVisible(true);
switchBtn->setStyleSheet("QPushButton{background-color:green;}");
switchBtn->setStyleSheet("QPushButton:checked{background-color:red;}");
if (on){
switchBtn->setChecked(true);
switchBtn->setText("on");
} else {
switchBtn->setChecked(false);
switchBtn->setText("off");
}
connect(switchBtn, SIGNAL(clicked(bool)), this, SLOT(on_btnClicked()));
}
setObjectName("BT");
setFont(font);
connect(this, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(on_itemClicked(QListWidgetItem *)));
show();
qDebug() << "bt init: " << on;
if(on)
turnOn();
}
qtBT::~qtBT()
{
#ifdef RKWIFIBTAPP
rk_bt_cancel_discovery();
#endif
if(switchBtn){
switchBtn->setVisible(false);
}
_instance = nullptr;
}
bool qtBT::isOn()
{
if(switchBtn){
if (! switchBtn->text().compare("on")){
return true;
} else {
return false;
}
}
return false;
}
void qtBT::turnOn()
{
if(QFile::exists("/userdata")){
open();
} else {
QStringList list;
list << "bt1" << "bt2" << "bt3" << "bt4" << "bt5" << "bt6" << "bt7";
addItems(list);
}
}
void qtBT::turnOff()
{
if(QFile::exists("/userdata")){
close();
}
clear();
}
void qtBT::on_btnClicked()
{
if(switchBtn){
if (! switchBtn->text().compare("on")){
qDebug() << "on_btnClicked turnOff";
switchBtn->setText("off");
turnOff();
} else if (! switchBtn->text().compare("off")){
qDebug() << "on_btnClicked turnOn";
switchBtn->setText("on");
turnOn();
}
}
}
void qtBT::on_itemClicked(QListWidgetItem *item)
{
QString str = item->text();
QStringList sl = str.split(" ");
QString pair = sl.at(0);
QString addr = sl.at(1);
QString name = sl.at(2);
if(!addr.isEmpty()){
if(!pair.compare("Paired")){
qDebug() << "connecting to " << addr.toLatin1().data();
#ifdef RKWIFIBTAPP
rk_bt_source_connect_by_addr(addr.toLatin1().data());
#endif
}else if(!pair.compare("Connected")){
qDebug() << "disconnecting " << addr << name;
#ifdef RKWIFIBTAPP
rk_bt_source_disconnect_by_addr(addr.toLatin1().data());
#endif
takeItem(row(item));
}else{
qDebug() << "connecting to " << addr.toLatin1().data();
#ifdef RKWIFIBTAPP
rk_bt_source_connect_by_addr(addr.toLatin1().data());
#endif
}
}
}
#include <QApplication>
#include <QDesktopWidget>
#include <QFileInfo>
#include <QMessageBox>
#include <QProcess>
#include "qtfactory.h"
#define UPDATE_EXE "/usr/bin/update"
qtFactoryReset::qtFactoryReset(QWidget *parent)
{
const QRect availableGeometry = QApplication::desktop()->availableGeometry(parent);
QFont font;
font.setBold(true);
font.setPixelSize(availableGeometry.height()/40);
label.setFont(font);
label.setText("Factory Reset will wipe all the user data.\n Make sure your device are ready.\n then click OK button.");
label.setAlignment(Qt::AlignCenter);
btn.setText("O K");
connect(&btn, SIGNAL(clicked(bool)), this, SLOT(on_btnClicked()));
vLayout.addWidget(&label);
vLayout.addWidget(&btn);
setLayout(&vLayout);
setStyleSheet("background-color:rgb(204,228,247)");
setObjectName("Factory Reset");
}
qtFactoryReset::~qtFactoryReset()
{
}
void qtFactoryReset::on_btnClicked()
{
QFileInfo update = QFileInfo(UPDATE_EXE);
QString path;
QMessageBox::StandardButton rb = QMessageBox::question(
this, "Factory Reset",
"Do you want to reboot and do factory reset? It will wipe all your user data",
QMessageBox::Yes | QMessageBox::No);
if(rb == QMessageBox::Yes){
if(update.exists()){
QProcess p;
p.start(UPDATE_EXE);
p.waitForStarted();
p.waitForFinished();
QString err = QString::fromLocal8Bit(p.readAllStandardOutput());
QMessageBox::critical(this, "Error", err);
}else {
QMessageBox::warning(this, "Error", "Don't find " UPDATE_EXE "!");
}
}
}
#include "qtinputdialog.h"
#include <QApplication>
#include <QDesktopWidget>
#include <QVBoxLayout>
inputDialog* inputDialog::_instance = nullptr;
inputDialog::inputDialog(QWidget *parent) : QDialog(parent),
m_eventLoop(nullptr)
{
const QRect availableGeometry = QApplication::desktop()->availableGeometry();
QVBoxLayout *mainLayout = new QVBoxLayout;
QFont font;
QFont fontname;
QFont fontedit;
QFont fontbutton;
font.setPixelSize(availableGeometry.height()/20);
fontname.setPixelSize(availableGeometry.height()/30);
fontedit.setPixelSize(availableGeometry.height()/15);
fontbutton.setPixelSize(availableGeometry.height()/25);
nameLabel = new QLabel(this);
nameLabel->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
nameLabel->setFont(fontname);
wordEdit = new QLineEdit(this);
wordEdit->setFont(fontedit);
yBtn.setFont(fontbutton);
nBtn.setFont(fontbutton);
QHBoxLayout *buttonlayout = new QHBoxLayout;
buttonlayout->addWidget(&yBtn);
buttonlayout->addWidget(&nBtn);
buttonlayout->setStretchFactor(&yBtn,1);
buttonlayout->setStretchFactor(&nBtn,1);
mainLayout->addWidget(nameLabel);
mainLayout->addSpacing(5);
mainLayout->addWidget(wordEdit);
mainLayout->addStretch(0);
mainLayout->addLayout(buttonlayout);
resize(availableGeometry.width()/3, availableGeometry.height() * 3/20);
setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
// setWindowFlags(Qt::FramelessWindowHint);
setLayout(mainLayout);
connect(&yBtn, SIGNAL(clicked()), this, SLOT(slot_onYesClicked()));
connect(&nBtn, SIGNAL(clicked()), this, SLOT(slot_onNoClicked()));
}
inputDialog::~inputDialog()
{
if(m_eventLoop != nullptr)
m_eventLoop->exit();
if(wordEdit != nullptr)
delete wordEdit;
if(nameLabel != nullptr)
delete nameLabel;
_instance = nullptr;
}
void inputDialog::setText(QString yes, QString no, QString text)
{
yBtn.setText(yes);
nBtn.setText(no);
nameLabel->setText(text);
}
int inputDialog::exec()
{
if(m_eventLoop != nullptr)
m_eventLoop->exit();
setWindowModality(Qt::WindowModal);
show();
m_eventLoop = new QEventLoop(this);
m_eventLoop->exec();
return m_chooseResult;
}
void inputDialog::exit(bool result)
{
if(m_eventLoop != nullptr) {
m_chooseResult = result;
close();
}
}
bool inputDialog::isRunning(void)
{
if(m_eventLoop != nullptr)
return m_eventLoop->isRunning();
return false;
}
void inputDialog::slot_onApplicationFocusChanged(QWidget *, QWidget *nowWidget)
{
if (nowWidget != nullptr && !isAncestorOf(nowWidget)) {
if (nowWidget->objectName().compare(parent()->objectName())) {
setVisible(true);
} else {
setVisible(false);
}
}
}
void inputDialog::slot_onYesClicked()
{
m_chooseResult = true;
close();
}
void inputDialog::slot_onNoClicked()
{
m_chooseResult = false;
close();
}
void inputDialog::closeEvent(QCloseEvent*)
{
if(m_eventLoop != nullptr)
m_eventLoop->exit();
}
#include "qtkeyboard.h"
#include "ui_qtkeyboard.h"
#include <QDebug>
#include <QTimer>
#include <QDesktopWidget>
QKeyBoard* QKeyBoard::_instance = nullptr;
#define str_board_close "Close"
#define SHIFT_ON "SHIFT"
#define SHIFT_OFF "shift"
QKeyBoard::QKeyBoard(QWidget *parent) : QWidget(parent),
ui(new Ui::QKeyBoard),
isShiftOn(false),
lineEdit(nullptr),
mousePressed(false)
{
ui->setupUi(this);
ui->btna->setProperty("btnLetter", true);
ui->btnb->setProperty("btnLetter", true);
ui->btnc->setProperty("btnLetter", true);
ui->btnd->setProperty("btnLetter", true);
ui->btne->setProperty("btnLetter", true);
ui->btnf->setProperty("btnLetter", true);
ui->btng->setProperty("btnLetter", true);
ui->btnh->setProperty("btnLetter", true);
ui->btni->setProperty("btnLetter", true);
ui->btnj->setProperty("btnLetter", true);
ui->btnk->setProperty("btnLetter", true);
ui->btnl->setProperty("btnLetter", true);
ui->btnm->setProperty("btnLetter", true);
ui->btnn->setProperty("btnLetter", true);
ui->btno->setProperty("btnLetter", true);
ui->btnp->setProperty("btnLetter", true);
ui->btnq->setProperty("btnLetter", true);
ui->btnr->setProperty("btnLetter", true);
ui->btns->setProperty("btnLetter", true);
ui->btnt->setProperty("btnLetter", true);
ui->btnu->setProperty("btnLetter", true);
ui->btnv->setProperty("btnLetter", true);
ui->btnw->setProperty("btnLetter", true);
ui->btnx->setProperty("btnLetter", true);
ui->btny->setProperty("btnLetter", true);
ui->btnz->setProperty("btnLetter", true);
const QRect availableGeometry = QApplication::desktop()->availableGeometry();
QFont font;
font.setPixelSize(availableGeometry.height()/20);
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)),
this, SLOT(slot_onApplicationFocusChanged(QWidget*, QWidget*)));
qApp->installEventFilter(this);
QList<QPushButton*> btns = this->findChildren<QPushButton*>();
foreach (QPushButton *button, btns) {
connect(button, SIGNAL(clicked()), this, SLOT(btn_clicked()));
button->setFont(font);
}
}
QKeyBoard::~QKeyBoard()
{
delete ui;
_instance = nullptr;
}
void QKeyBoard::changeInputType(bool on)
{
QString str;
ui->btnShift->setText(on?SHIFT_ON:SHIFT_OFF);
QList<QPushButton*> buttons = this->findChildren<QPushButton*>();
foreach (QPushButton *button, buttons) {
if (button->property("btnLetter").toBool()) {
if (on)
button->setText(button->text().toUpper());
else
button->setText(button->text().toLower());
} else if(! button->objectName().compare("btnApostrophe")){
button->setText(on?"\"":"\'");
} else if(! button->objectName().compare("btnBackslash")){
button->setText(on?"|":"\\");
} else if(! button->objectName().compare("btnComma")){
button->setText(on?"<":",");
} else if(! button->objectName().compare("btnDash")){
button->setText(on?"_":"-");
} else if(! button->objectName().compare("btnDot")){
button->setText(on?">":".");
} else if(! button->objectName().compare("btnEquals")){
button->setText(on?"+":"=");
} else if(! button->objectName().compare("btnSemicolon")){
button->setText(on?":":";");
} else if(! button->objectName().compare("btnSlash")){
button->setText(on?"?":"/");
} else if(! button->objectName().compare("btnOther1")){
button->setText(on?"~":"`");
} else if(! button->objectName().compare("btnOther2")){
button->setText(on?"{":"[");
} else if(! button->objectName().compare("btnOther3")){
button->setText(on?"}":"]");
} else if(! button->objectName().compare("btn1")){
button->setText(on?"!":"1");
} else if(! button->objectName().compare("btn2")){
button->setText(on?"@":"2");
} else if(! button->objectName().compare("btn3")){
button->setText(on?"#":"3");
} else if(! button->objectName().compare("btn4")){
button->setText(on?"$":"4");
} else if(! button->objectName().compare("btn5")){
button->setText(on?"%":"5");
} else if(! button->objectName().compare("btn6")){
button->setText(on?"^":"6");
} else if(! button->objectName().compare("btn7")){
button->setText(on?"&":"7");
} else if(! button->objectName().compare("btn8")){
button->setText(on?"*":"8");
} else if(! button->objectName().compare("btn9")){
button->setText(on?"(":"9");
} else if(! button->objectName().compare("btn0")){
button->setText(on?")":"0");
}
}
}
void QKeyBoard::showPanel()
{
changeInputType(isShiftOn);
this->setVisible(true);
}
void QKeyBoard::hidePanel()
{
this->setVisible(false);
}
void QKeyBoard::slot_onApplicationFocusChanged(QWidget *, QWidget *nowWidget)
{
if (nowWidget != nullptr && !this->isAncestorOf(nowWidget)) {
if (nowWidget->inherits("QLineEdit")) {
lineEdit = (QLineEdit*)nowWidget;
showPanel();
} else {
hidePanel();
}
const QRect availableGeometry = QApplication::desktop()->availableGeometry();
resize(availableGeometry.width(), height());
move(0, availableGeometry.height() - height());
}
}
void QKeyBoard::btn_clicked()
{
if (lineEdit == nullptr) {
return;
}
QPushButton *button = (QPushButton*)sender();
QString objectName = button->objectName();
if (objectName == "btnBackspace") {
lineEdit->backspace();
} else if (objectName == "btnClose") {
// foucs other widget first.
if (lineEdit && lineEdit->parentWidget())
lineEdit->parentWidget()->setFocus();
hidePanel();
} else if (objectName == "btnSpace") {
insertValue(" ");
} else if (objectName == "btnShift") {
isShiftOn = (isShiftOn == true) ? false : true;
changeInputType(isShiftOn);
} else {
insertValue(button->text());
}
}
void QKeyBoard::insertValue(const QString &value)
{
if (lineEdit->text().length() < 20)
lineEdit->insert(value);
}
void QKeyBoard::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
mousePressed = true;
mousePoint = event->globalPos() - this->pos();
event->accept();
}
}
void QKeyBoard::mouseMoveEvent(QMouseEvent *event)
{
if (mousePressed && event->buttons() == Qt::LeftButton) {
this->move(event->globalPos() - mousePoint);
event->accept();
}
}
void QKeyBoard::mouseReleaseEvent(QMouseEvent *)
{
mousePressed = false;
}
#include <QApplication>
#include <QDesktopWidget>
#include <QFileInfo>
#include <QMessageBox>
#include <QProcess>
#include "qtupdate.h"
#define SD_UPDATE_FILE "/sdcard/update.img"
#define DATA_UPDATE_FILE "/userdata/update.img"
#define UPDATE_EXE "/usr/bin/update"
qtUpdate::qtUpdate(QWidget *parent)
{
const QRect availableGeometry = QApplication::desktop()->availableGeometry(parent);
QString s = "Please put update.img in \n";
s.append(SD_UPDATE_FILE);
s.append("\n or \n");
s.append(DATA_UPDATE_FILE);
s.append("\n then click OK button.");
QFont font;
font.setBold(true);
font.setPixelSize(availableGeometry.height()/40);
label.setFont(font);
label.setText(s);
label.setAlignment(Qt::AlignCenter);
btn.setText("O K");
connect(&btn, SIGNAL(clicked(bool)), this, SLOT(on_btnClicked()));
vLayout.addWidget(&label);
vLayout.addWidget(&btn);
setLayout(&vLayout);
setStyleSheet("background-color:rgb(204,228,247)");
setObjectName("Update");
}
qtUpdate::~qtUpdate()
{
}
void qtUpdate::on_btnClicked()
{
QFileInfo userdata = QFileInfo(DATA_UPDATE_FILE);
QFileInfo sd = QFileInfo(SD_UPDATE_FILE);
QFileInfo update = QFileInfo(UPDATE_EXE);
QString path;
if(userdata.exists()){
path = DATA_UPDATE_FILE;
}else if(sd.exists()){
path = SD_UPDATE_FILE;
}else {
QMessageBox::warning(this, "Error", "Don't find update.img in " DATA_UPDATE_FILE " and " SD_UPDATE_FILE "!");
return;
}
QMessageBox::StandardButton rb = QMessageBox::question(
this, "Update",
"Found update.img in " + path + ", Do you want to reboot and update it?",
QMessageBox::Yes | QMessageBox::No);
if(rb == QMessageBox::Yes){
if(update.exists()){
QStringList slist;
QProcess p;
slist << "ota" << path;
p.start(UPDATE_EXE, slist);
p.waitForStarted();
p.waitForFinished();
QString err = QString::fromLocal8Bit(p.readAllStandardOutput());
QMessageBox::critical(this, "Error", err);
}else {
QMessageBox::warning(this, "Error", "Don't find " UPDATE_EXE "!");
}
}
}
#include <QApplication>
#include <QDebug>
#include <QDesktopWidget>
#include <QListWidgetItem>
#include <QProcess>
#include <QTextStream>
#include "qtkeyboard.h"
#include "qtinputdialog.h"
#include "qtwifi.h"
#include "Rk_softap.h"
#include "Rk_softap.h"
qtWifi* qtWifi::_instance = nullptr;
qtWifi::qtWifi(QWidget *parent, QLabel *label, QPushButton *btn, bool on)
{
const QRect availableGeometry = QApplication::desktop()->availableGeometry(parent);
resize(availableGeometry.width(), availableGeometry.height());
QFont font;
font.setPixelSize(availableGeometry.height()/20);
if(btn){
switchBtn = btn;
switchBtn->setCheckable(true);
switchBtn->setVisible(true);
switchBtn->setStyleSheet("QPushButton{background-color:green;}");
switchBtn->setStyleSheet("QPushButton:checked{background-color:red;}");
if (on){
switchBtn->setChecked(true);
switchBtn->setText("on");
} else {
switchBtn->setChecked(false);
switchBtn->setText("off");
}
connect(switchBtn, SIGNAL(clicked(bool)), this, SLOT(on_btnClicked()));
}
if(label){
text = label;
text->setText("");
text->setVisible(true);
}else {
text = nullptr;
}
setObjectName("WiFi");
setFont(font);
Timer = new QTimer(this);
connect(this, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(on_itemClicked(QListWidgetItem *)));
show();
if (on)
turnOn();
}
qtWifi::~qtWifi()
{
if (switchBtn)
switchBtn->setVisible(false);
if (text)
text->setVisible(false);
_instance = nullptr;
}
void qtWifi::turnOn()
{
RK_wifi_register_callback(wifi_callback);
if (RK_wifi_enable(1) < 0)
printf("[%s] Rk_wifi_enable 1 fail!\n", __func__);
Timer->stop();
Timer->setInterval(10000);
connect(Timer, SIGNAL(timeout()), this, SLOT(on_timer_timeout()));
if (text)
text->setVisible(true);
Timer->start();
text->setText("Scaning");
}
void qtWifi::turnOff()
{
if (RK_wifi_enable(0) < 0)
printf("RK_wifi_enable 0 fail!\n");
Timer->stop();
clear();
if (text)
text->setVisible(false);
}
static int search_for_ssid(const char *str)
{
const char key[] = "\"ssid\"";
int i;
if (strlen(str) < strlen(key))
return -1;
for (i = 0; i < (strlen(str) - strlen(key)); i++) {
if (!strncmp(key, &str[i], strlen(key)))
return i;
}
return -1;
}
static char *get_string(const char *str)
{
int i, begin = -1, count;
char *dst;
for (i = 0; i < strlen(str); i++) {
if (str[i] == '\"') {
if (begin == -1) {
begin = i;
continue;
} else {
count = i - begin -1;
if (!count)
return NULL;
dst = strndup(&str[begin + 1], count);
return dst;
}
}
}
return NULL;
}
int qtWifi::wifi_callback(RK_WIFI_RUNNING_State_e state,
RK_WIFI_INFO_Connection_s *info)
{
qtWifi *wifi = qtWifi::getInstance();
if (state == RK_WIFI_State_CONNECTED) {
printf("RK_WIFI_State_CONNECTED\n");
//wifi->ssid = QLatin1String(info->ssid);
wifi->ssid = QString(info->ssid);
wifi->text->setText(wifi->ssid + " Connected");
} else if (state == RK_WIFI_State_CONNECTFAILED) {
printf("RK_WIFI_State_CONNECTFAILED\n");
} else if (state == RK_WIFI_State_CONNECTFAILED_WRONG_KEY) {
printf("RK_WIFI_State_CONNECTFAILED_WRONG_KEY\n");
} else if (state == RK_WIFI_State_OPEN) {
printf("RK_WIFI_State_OPEN\n");
} else if (state == RK_WIFI_State_OFF) {
printf("RK_WIFI_State_OFF\n");
} else if (state == RK_WIFI_State_DISCONNECTED) {
printf("RK_WIFI_State_DISCONNECTED\n");
wifi->text->setText("Scaning");
} else if (state == RK_WIFI_State_SCAN_RESULTS) {
char *scan_r, *str = nullptr;
int cnt = 0, tmp = 0;
QString line;
QStringList list;
if (wifi == nullptr)
return 0;
scan_r = strdup(RK_wifi_scan_r());
wifi->clear();
while (1) {
tmp = search_for_ssid(&scan_r[cnt]);
if (tmp == -1)
break;
str = get_string(&scan_r[cnt + tmp + 6]);
if (str == NULL) {
line = QString("NULL");
} else {
line = QString(str);
free(str);
}
list.removeAll("NULL");
list << line;
cnt += tmp + 6;
}
wifi->addItems(list);
free(scan_r);
}
return 0;
}
bool qtWifi::isOn()
{
if(switchBtn){
if (! switchBtn->text().compare("on")){
return true;
} else {
return false;
}
}
return false;
}
void qtWifi::on_itemClicked(QListWidgetItem *item)
{
QKeyBoard::getInstance();
inputDialog *dialog = inputDialog::getInstance(this);
const char *c_ssid, *pswd;
ssid = item->text();
dialog->setText("Connect", "Cancel", "Password of " + item->text());
if (dialog->isRunning())
dialog->exit(false);
int result = dialog->exec();
if(result){
QString str = dialog->getEditText();
QProcess p;
QStringList arguments;
std::string s_ssid = ssid.toStdString();
c_ssid = s_ssid.c_str();
std::string s_pswd = str.toStdString();
pswd = s_pswd.c_str();
printf("ssid: %s, %s\n", c_ssid, pswd);
if (RK_wifi_connect((char *)c_ssid, pswd) < 0)
printf("RK_wifi_connect1 fail!\n");
}
}
void qtWifi::on_btnClicked()
{
if(switchBtn){
if (! switchBtn->text().compare("on")){
switchBtn->setText("off");
turnOff();
} else if (! switchBtn->text().compare("off")){
switchBtn->setText("on");
turnOn();
}
}
}
void qtWifi::on_timer_timeout()
{
printf("refresh\n");
if (RK_wifi_scan() < 0)
printf("RK_wifi_scan fail!\n");
Timer->start();
}
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QKeyBoard</class>
<widget class="QWidget" name="QKeyBoard">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>577</width>
<height>172</height>
</rect>
</property>
<property name="windowTitle">
<string>中文输入法面板</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QWidget" name="widgetMain" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>2</number>
</property>
<item row="3" column="12">
<widget class="QPushButton" name="btnShift">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Shift</string>
</property>
</widget>
</item>
<item row="4" column="6">
<widget class="QPushButton" name="btnj">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>j</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="btns">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>s</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QPushButton" name="btnt">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>t</string>
</property>
</widget>
</item>
<item row="0" column="12">
<widget class="QPushButton" name="btnBackspace">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>←</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QPushButton" name="btn6">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>6</string>
</property>
</widget>
</item>
<item row="4" column="11">
<widget class="QPushButton" name="btnBackslash">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>\</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="btnOther1">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>`</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="btnx">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>x</string>
</property>
</widget>
</item>
<item row="6" column="7">
<widget class="QPushButton" name="btnm">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>m</string>
</property>
</widget>
</item>
<item row="6" column="6">
<widget class="QPushButton" name="btnn">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>n</string>
</property>
</widget>
</item>
<item row="6" column="11">
<widget class="QPushButton" name="btnEquals">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>=</string>
</property>
</widget>
</item>
<item row="3" column="5">
<widget class="QPushButton" name="btny">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>y</string>
</property>
</widget>
</item>
<item row="6" column="9">
<widget class="QPushButton" name="btnDot">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>.</string>
</property>
</widget>
</item>
<item row="4" column="8">
<widget class="QPushButton" name="btnl">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>l</string>
</property>
</widget>
</item>
<item row="4" column="9">
<widget class="QPushButton" name="btnSemicolon">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>;</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="btna">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>a</string>
</property>
</widget>
</item>
<item row="3" column="6">
<widget class="QPushButton" name="btnu">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>u</string>
</property>
</widget>
</item>
<item row="3" column="10">
<widget class="QPushButton" name="btnOther2">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>[</string>
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="QPushButton" name="btn9">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>9</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="btnw">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>w</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="btnr">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>r</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="btne">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>e</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="btnq">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>q</string>
</property>
</widget>
</item>
<item row="3" column="7">
<widget class="QPushButton" name="btni">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>i</string>
</property>
</widget>
</item>
<item row="3" column="8">
<widget class="QPushButton" name="btno">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>o</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="btn2">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>2</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="btn1">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>1</string>
</property>
</widget>
</item>
<item row="6" column="4">
<widget class="QPushButton" name="btnv">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>v</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="btnd">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>d</string>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QPushButton" name="btng">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>g</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QPushButton" name="btn7">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>7</string>
</property>
</widget>
</item>
<item row="4" column="7">
<widget class="QPushButton" name="btnk">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>k</string>
</property>
</widget>
</item>
<item row="4" column="5">
<widget class="QPushButton" name="btnh">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>h</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QPushButton" name="btnc">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>c</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="btn3">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>3</string>
</property>
</widget>
</item>
<item row="0" column="11">
<widget class="QPushButton" name="btnDash">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QPushButton" name="btnf">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>f</string>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QPushButton" name="btn8">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>8</string>
</property>
</widget>
</item>
<item row="6" column="10">
<widget class="QPushButton" name="btnSlash">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>/</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="btnz">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>z</string>
</property>
</widget>
</item>
<item row="3" column="11">
<widget class="QPushButton" name="btnOther3">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>]</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="btn5">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>5</string>
</property>
</widget>
</item>
<item row="4" column="10">
<widget class="QPushButton" name="btnApostrophe">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>'</string>
</property>
</widget>
</item>
<item row="6" column="8">
<widget class="QPushButton" name="btnComma">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>,</string>
</property>
</widget>
</item>
<item row="3" column="9">
<widget class="QPushButton" name="btnp">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>p</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="btn4">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>4</string>
</property>
</widget>
</item>
<item row="6" column="5">
<widget class="QPushButton" name="btnb">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>b</string>
</property>
</widget>
</item>
<item row="0" column="10">
<widget class="QPushButton" name="btn0">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="4" column="12">
<widget class="QPushButton" name="btnClose">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnSpace">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Space</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>