mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
The search button now does something
And it does what you'd expect it to! Only dictionary search available at the moment.
This commit is contained in:
parent
e9c17ca382
commit
13803ef333
11 changed files with 500 additions and 33 deletions
122
dictionarywidget.cpp
Normal file
122
dictionarywidget.cpp
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
#include "dictionarywidget.h"
|
||||||
|
#include "ui_dictionarywidget.h"
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <iostream>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
dictionaryWidget::dictionaryWidget(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::dictionaryWidget)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->backBtn->setProperty("type", "borderless");
|
||||||
|
ui->backBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
||||||
|
ui->nextDefinitionBtn->setProperty("type", "borderless");
|
||||||
|
ui->previousDefinitionBtn->setProperty("type", "borderless");
|
||||||
|
|
||||||
|
ui->nextDefinitionBtn->setText("");
|
||||||
|
ui->nextDefinitionBtn->setIcon(QIcon(":/resources/chevron-right.png"));
|
||||||
|
ui->previousDefinitionBtn->setText("");
|
||||||
|
ui->previousDefinitionBtn->setIcon(QIcon(":/resources/chevron-left.png"));
|
||||||
|
|
||||||
|
QStringList parts = global::keyboard::keyboardText.split(' ', QString::SkipEmptyParts);
|
||||||
|
for (int i = 0; i < parts.size(); ++i)
|
||||||
|
parts[i].replace(0, 1, parts[i][0].toUpper());
|
||||||
|
wordQstr = parts.join(" ");
|
||||||
|
searchedWord = wordQstr.toStdString();
|
||||||
|
letter = global::keyboard::keyboardText.left(1);
|
||||||
|
letter = letter.toUpper();
|
||||||
|
dictionaryPosition = 1;
|
||||||
|
|
||||||
|
dictionaryLookup(searchedWord, letter, dictionaryPosition);
|
||||||
|
|
||||||
|
definition.prepend("<div align='justify'>");
|
||||||
|
definition.append("</div>");
|
||||||
|
ui->wordLabel->setText(wordQstr);
|
||||||
|
ui->definitionLabel->setText(definition);
|
||||||
|
ui->definitionStatusLabel->setText("1");
|
||||||
|
|
||||||
|
QTimer::singleShot(1000, this, SLOT(refreshScreenNative()));
|
||||||
|
}
|
||||||
|
|
||||||
|
dictionaryWidget::~dictionaryWidget()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dictionaryWidget::on_backBtn_clicked()
|
||||||
|
{
|
||||||
|
dictionaryWidget::close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dictionaryWidget::dictionaryLookup(std::string word, QString first_letter, int position) {
|
||||||
|
QDir dictdir;
|
||||||
|
dictdir.mkpath("/inkbox/dictionary");
|
||||||
|
|
||||||
|
std::ofstream fhandler;
|
||||||
|
fhandler.open("/inkbox/dictionary/word");
|
||||||
|
fhandler << word;
|
||||||
|
fhandler.close();
|
||||||
|
|
||||||
|
QDir::setCurrent("dictionary");
|
||||||
|
QDir::setCurrent(first_letter);
|
||||||
|
QString lookup_prog ("sh");
|
||||||
|
QStringList lookup_args;
|
||||||
|
QString position_str = QString::number(position);
|
||||||
|
lookup_args << "../scripts/lookup.sh" << position_str;
|
||||||
|
QProcess *lookup_proc = new QProcess();
|
||||||
|
lookup_proc->start(lookup_prog, lookup_args);
|
||||||
|
lookup_proc->waitForFinished();
|
||||||
|
|
||||||
|
QFile definition_file("/inkbox/dictionary/definition");
|
||||||
|
definition_file.open(QIODevice::ReadWrite);
|
||||||
|
QTextStream in (&definition_file);
|
||||||
|
definition = in.readAll();
|
||||||
|
definition = definition.remove(QRegExp("[\n]"));
|
||||||
|
if(definition == "No definition found.") {
|
||||||
|
nextdefinition_lock = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nextdefinition_lock = false;
|
||||||
|
}
|
||||||
|
definition_file.close();
|
||||||
|
|
||||||
|
setDefaultWorkDir();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dictionaryWidget::on_nextDefinitionBtn_clicked()
|
||||||
|
{
|
||||||
|
dictionaryPosition = dictionaryPosition + 1;
|
||||||
|
dictionaryLookup(searchedWord, letter, dictionaryPosition);
|
||||||
|
if(nextdefinition_lock == true) {
|
||||||
|
dictionaryPosition = dictionaryPosition - 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->definitionLabel->setText(definition);
|
||||||
|
QString dictionaryPositionQstr = QString::number(dictionaryPosition);
|
||||||
|
ui->definitionStatusLabel->setText(dictionaryPositionQstr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dictionaryWidget::on_previousDefinitionBtn_clicked()
|
||||||
|
{
|
||||||
|
dictionaryPosition = dictionaryPosition - 1;
|
||||||
|
if(dictionaryPosition <= 0) {
|
||||||
|
dictionaryPosition = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dictionaryLookup(searchedWord, letter, dictionaryPosition);
|
||||||
|
ui->definitionLabel->setText(definition);
|
||||||
|
QString dictionaryPositionQstr = QString::number(dictionaryPosition);
|
||||||
|
ui->definitionStatusLabel->setText(dictionaryPositionQstr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dictionaryWidget::refreshScreenNative() {
|
||||||
|
emit refreshScreen();
|
||||||
|
}
|
40
dictionarywidget.h
Normal file
40
dictionarywidget.h
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#ifndef DICTIONARYWIDGET_H
|
||||||
|
#define DICTIONARYWIDGET_H
|
||||||
|
|
||||||
|
#include "functions.h"
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class dictionaryWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class dictionaryWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit dictionaryWidget(QWidget *parent = nullptr);
|
||||||
|
~dictionaryWidget();
|
||||||
|
void dictionaryLookup(std::string word, QString first_letter, int position);
|
||||||
|
QString wordQstr;
|
||||||
|
QString definition;
|
||||||
|
QString letter;
|
||||||
|
std::string searchedWord;
|
||||||
|
bool nextdefinition_lock = false;
|
||||||
|
int dictionaryPosition;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_backBtn_clicked();
|
||||||
|
void on_nextDefinitionBtn_clicked();
|
||||||
|
void on_previousDefinitionBtn_clicked();
|
||||||
|
void refreshScreenNative();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::dictionaryWidget *ui;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void refreshScreen();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DICTIONARYWIDGET_H
|
135
dictionarywidget.ui
Normal file
135
dictionarywidget.ui
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>dictionaryWidget</class>
|
||||||
|
<widget class="QWidget" name="dictionaryWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QTextEdit" name="definitionLabel">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Source Serif Pro</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="4">
|
||||||
|
<widget class="QPushButton" name="nextDefinitionBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Next</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="wordLabel">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Inter</family>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Word</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QLabel" name="definitionStatusLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Status</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::AutoText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QPushButton" name="previousDefinitionBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Previous</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QPushButton" name="backBtn">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Back</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -62,14 +62,15 @@ namespace global {
|
||||||
namespace keyboard {
|
namespace keyboard {
|
||||||
inline bool keyboardDialog;
|
inline bool keyboardDialog;
|
||||||
inline bool keypadDialog;
|
inline bool keypadDialog;
|
||||||
|
inline bool searchDialog;
|
||||||
inline QString keyboardText;
|
inline QString keyboardText;
|
||||||
inline QString keypadText;
|
inline QString keypadText;
|
||||||
}
|
}
|
||||||
inline QString systemInfoText;
|
inline QString systemInfoText;
|
||||||
|
inline bool forbidOpenSearchDialog;
|
||||||
inline bool isN705;
|
inline bool isN705;
|
||||||
inline bool isN905C;
|
inline bool isN905C;
|
||||||
inline bool isN613;
|
inline bool isN613;
|
||||||
inline int *readerptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/6080853/c-multiple-definition-error-for-global-functions-in-the-header-file/20679534#20679534
|
// https://stackoverflow.com/questions/6080853/c-multiple-definition-error-for-global-functions-in-the-header-file/20679534#20679534
|
||||||
|
@ -226,7 +227,7 @@ namespace {
|
||||||
void writeconfig(std::string file, std::string config) {
|
void writeconfig(std::string file, std::string config) {
|
||||||
std::ofstream fhandler;
|
std::ofstream fhandler;
|
||||||
fhandler.open(file);
|
fhandler.open(file);
|
||||||
fhandler << config << std::boolalpha << checked_box << endl;
|
fhandler << config << std::boolalpha << checked_box << std::endl;
|
||||||
fhandler.close();
|
fhandler.close();
|
||||||
}
|
}
|
||||||
bool checkconfig_match(QString file, std::string pattern) {
|
bool checkconfig_match(QString file, std::string pattern) {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
generalDialog::generalDialog(QWidget *parent) :
|
generalDialog::generalDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
|
@ -33,6 +34,7 @@ generalDialog::generalDialog(QWidget *parent) :
|
||||||
ui->cancelBtn->setStyleSheet("font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey");
|
ui->cancelBtn->setStyleSheet("font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey");
|
||||||
ui->acceptBtn->setStyleSheet("font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey");
|
ui->acceptBtn->setStyleSheet("font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey");
|
||||||
ui->bodyLabel->setStyleSheet("font-size: 9pt");
|
ui->bodyLabel->setStyleSheet("font-size: 9pt");
|
||||||
|
ui->searchComboBox->setStyleSheet("font-size: 9pt");
|
||||||
|
|
||||||
if(checkconfig("/inkbox/resetDialog") == true) {
|
if(checkconfig("/inkbox/resetDialog") == true) {
|
||||||
if(checkconfig("/opt/inkbox_genuine") == true) {
|
if(checkconfig("/opt/inkbox_genuine") == true) {
|
||||||
|
@ -113,15 +115,7 @@ generalDialog::generalDialog(QWidget *parent) :
|
||||||
this->adjustSize();
|
this->adjustSize();
|
||||||
}
|
}
|
||||||
else if(global::keyboard::keyboardDialog == true) {
|
else if(global::keyboard::keyboardDialog == true) {
|
||||||
keyboardDialog = true;
|
setupKeyboardDialog();
|
||||||
keyboardWidget = new virtualkeyboard();
|
|
||||||
connect(keyboardWidget, SIGNAL(adjust_size()), SLOT(adjust_size()));
|
|
||||||
ui->headerLabel->setText("Enter a string");
|
|
||||||
ui->okBtn->setText("OK");
|
|
||||||
ui->cancelBtn->setText("Cancel");
|
|
||||||
ui->mainStackedWidget->insertWidget(1, keyboardWidget);
|
|
||||||
ui->mainStackedWidget->setCurrentIndex(1);
|
|
||||||
QTimer::singleShot(1000, this, SLOT(adjust_size()));
|
|
||||||
}
|
}
|
||||||
else if(global::keyboard::keypadDialog == true) {
|
else if(global::keyboard::keypadDialog == true) {
|
||||||
keypadDialog = true;
|
keypadDialog = true;
|
||||||
|
@ -161,6 +155,12 @@ void generalDialog::on_cancelBtn_clicked()
|
||||||
generalDialog::close();
|
generalDialog::close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if(global::keyboard::searchDialog == true) {
|
||||||
|
global::keyboard::searchDialog = false;
|
||||||
|
global::forbidOpenSearchDialog = true;
|
||||||
|
global::keyboard::keyboardDialog = false;
|
||||||
|
global::keyboard::keyboardText = "";
|
||||||
|
}
|
||||||
generalDialog::close();
|
generalDialog::close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,9 +215,35 @@ void generalDialog::on_okBtn_clicked()
|
||||||
generalDialog::close();
|
generalDialog::close();
|
||||||
}
|
}
|
||||||
if(keyboardDialog == true) {
|
if(keyboardDialog == true) {
|
||||||
|
if(global::keyboard::searchDialog == true) {
|
||||||
|
if(global::keyboard::keyboardText != "") {
|
||||||
|
if(ui->searchComboBox->currentText() == "Dictionary") {
|
||||||
|
for(int i = ui->mainStackedWidget->count(); i >= 0; i--) {
|
||||||
|
QWidget * widget = ui->mainStackedWidget->widget(i);
|
||||||
|
ui->mainStackedWidget->removeWidget(widget);
|
||||||
|
widget->deleteLater();
|
||||||
|
}
|
||||||
|
ui->topStackedWidget->setVisible(false);
|
||||||
|
ui->stackedWidget->setVisible(false);
|
||||||
|
dictionaryWidgetWindow = new dictionaryWidget();
|
||||||
|
dictionaryWidgetWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
connect(dictionaryWidgetWindow, SIGNAL(refreshScreen()), SLOT(refreshScreenNative()));
|
||||||
|
connect(dictionaryWidgetWindow, SIGNAL(destroyed(QObject*)), SLOT(restartSearchDialog()));
|
||||||
|
ui->mainStackedWidget->insertWidget(1, dictionaryWidgetWindow);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QMessageBox::critical(this, tr("Invalid argument"), tr("Please type in a search term."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
global::keyboard::keyboardDialog = false;
|
global::keyboard::keyboardDialog = false;
|
||||||
generalDialog::close();
|
generalDialog::close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void generalDialog::on_acceptBtn_clicked()
|
void generalDialog::on_acceptBtn_clicked()
|
||||||
{
|
{
|
||||||
|
@ -254,3 +280,30 @@ void generalDialog::adjust_size() {
|
||||||
this->move(x, y);
|
this->move(x, y);
|
||||||
emit refreshScreen();
|
emit refreshScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void generalDialog::restartSearchDialog() {
|
||||||
|
generalDialog::close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void generalDialog::setupKeyboardDialog() {
|
||||||
|
keyboardDialog = true;
|
||||||
|
ui->stackedWidget->setVisible(true);
|
||||||
|
if(global::keyboard::searchDialog == true) {
|
||||||
|
ui->topStackedWidget->setCurrentIndex(1);
|
||||||
|
ui->searchHeaderLabel->setText("Search");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->headerLabel->setText("Enter a string");
|
||||||
|
}
|
||||||
|
keyboardWidget = new virtualkeyboard();
|
||||||
|
connect(keyboardWidget, SIGNAL(adjust_size()), SLOT(adjust_size()));
|
||||||
|
ui->okBtn->setText("Search");
|
||||||
|
ui->cancelBtn->setText("Close");
|
||||||
|
ui->mainStackedWidget->insertWidget(1, keyboardWidget);
|
||||||
|
ui->mainStackedWidget->setCurrentIndex(1);
|
||||||
|
QTimer::singleShot(1000, this, SLOT(adjust_size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void generalDialog::refreshScreenNative() {
|
||||||
|
emit refreshScreen();
|
||||||
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "textwidget.h"
|
#include "textwidget.h"
|
||||||
#include "virtualkeyboard.h"
|
#include "virtualkeyboard.h"
|
||||||
#include "virtualkeypad.h"
|
#include "virtualkeypad.h"
|
||||||
|
#include "dictionarywidget.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -31,12 +32,16 @@ public:
|
||||||
bool resetKoboxDialog = false;
|
bool resetKoboxDialog = false;
|
||||||
bool keyboardDialog = false;
|
bool keyboardDialog = false;
|
||||||
bool keypadDialog = false;
|
bool keypadDialog = false;
|
||||||
|
bool dictionaryResults = false;
|
||||||
|
void setupKeyboardDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_cancelBtn_clicked();
|
void on_cancelBtn_clicked();
|
||||||
void on_okBtn_clicked();
|
void on_okBtn_clicked();
|
||||||
void on_acceptBtn_clicked();
|
void on_acceptBtn_clicked();
|
||||||
void adjust_size();
|
void adjust_size();
|
||||||
|
void restartSearchDialog();
|
||||||
|
void refreshScreenNative();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::generalDialog *ui;
|
Ui::generalDialog *ui;
|
||||||
|
@ -44,6 +49,7 @@ private:
|
||||||
textwidget *textwidgetWindow;
|
textwidget *textwidgetWindow;
|
||||||
virtualkeyboard *keyboardWidget;
|
virtualkeyboard *keyboardWidget;
|
||||||
virtualkeypad *keypadWidget;
|
virtualkeypad *keypadWidget;
|
||||||
|
dictionaryWidget *dictionaryWidgetWindow;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void gotoPageSelected(int value);
|
void gotoPageSelected(int value);
|
||||||
|
|
|
@ -116,6 +116,27 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QStackedWidget" name="topStackedWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="page_5">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="headerLabel">
|
<widget class="QLabel" name="headerLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
@ -135,6 +156,78 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_6">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_7">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Where:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="searchHeaderLabel">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Inter</family>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Header</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QComboBox" name="searchComboBox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Dictionary</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QStackedWidget" name="mainStackedWidget">
|
<widget class="QStackedWidget" name="mainStackedWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
|
|
|
@ -15,6 +15,7 @@ SOURCES += \
|
||||||
apps.cpp \
|
apps.cpp \
|
||||||
brightnessdialog.cpp \
|
brightnessdialog.cpp \
|
||||||
calendarapp.cpp \
|
calendarapp.cpp \
|
||||||
|
dictionarywidget.cpp \
|
||||||
generaldialog.cpp \
|
generaldialog.cpp \
|
||||||
koboxappsdialog.cpp \
|
koboxappsdialog.cpp \
|
||||||
koboxsettings.cpp \
|
koboxsettings.cpp \
|
||||||
|
@ -35,6 +36,7 @@ HEADERS += \
|
||||||
apps.h \
|
apps.h \
|
||||||
brightnessdialog.h \
|
brightnessdialog.h \
|
||||||
calendarapp.h \
|
calendarapp.h \
|
||||||
|
dictionarywidget.h \
|
||||||
functions.h \
|
functions.h \
|
||||||
generaldialog.h \
|
generaldialog.h \
|
||||||
koboxappsdialog.h \
|
koboxappsdialog.h \
|
||||||
|
@ -55,6 +57,7 @@ FORMS += \
|
||||||
apps.ui \
|
apps.ui \
|
||||||
brightnessdialog.ui \
|
brightnessdialog.ui \
|
||||||
calendarapp.ui \
|
calendarapp.ui \
|
||||||
|
dictionarywidget.ui \
|
||||||
generaldialog.ui \
|
generaldialog.ui \
|
||||||
koboxappsdialog.ui \
|
koboxappsdialog.ui \
|
||||||
koboxsettings.ui \
|
koboxsettings.ui \
|
||||||
|
|
|
@ -617,12 +617,8 @@ void MainWindow::on_pushButton_clicked()
|
||||||
|
|
||||||
void MainWindow::on_searchBtn_clicked()
|
void MainWindow::on_searchBtn_clicked()
|
||||||
{
|
{
|
||||||
// Hopefully this button will do something one day...
|
global::forbidOpenSearchDialog = false;
|
||||||
global::keyboard::keyboardDialog = true;
|
setupSearchDialog();
|
||||||
generalDialogWindow = new generalDialog();
|
|
||||||
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
connect(generalDialogWindow, SIGNAL(refreshScreen()), SLOT(refreshScreen()));
|
|
||||||
generalDialogWindow->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_quitBtn_clicked()
|
void MainWindow::on_quitBtn_clicked()
|
||||||
|
@ -810,3 +806,19 @@ void MainWindow::setInitialBrightness() {
|
||||||
void MainWindow::refreshScreen() {
|
void MainWindow::refreshScreen() {
|
||||||
this->repaint();
|
this->repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::setupSearchDialog() {
|
||||||
|
if(global::forbidOpenSearchDialog == false) {
|
||||||
|
global::keyboard::keyboardDialog = true;
|
||||||
|
global::keyboard::searchDialog = true;
|
||||||
|
global::keyboard::keyboardText = "";
|
||||||
|
generalDialogWindow = new generalDialog();
|
||||||
|
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
connect(generalDialogWindow, SIGNAL(refreshScreen()), SLOT(refreshScreen()));
|
||||||
|
connect(generalDialogWindow, SIGNAL(destroyed(QObject*)), SLOT(setupSearchDialog()));
|
||||||
|
generalDialogWindow->show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ private slots:
|
||||||
void setInitialBrightness();
|
void setInitialBrightness();
|
||||||
void on_homeBtn_clicked();
|
void on_homeBtn_clicked();
|
||||||
void refreshScreen();
|
void refreshScreen();
|
||||||
|
void setupSearchDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "ui_virtualkeyboard.h"
|
#include "ui_virtualkeyboard.h"
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
virtualkeyboard::virtualkeyboard(QWidget *parent) :
|
virtualkeyboard::virtualkeyboard(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
|
@ -116,7 +117,7 @@ void virtualkeyboard::on_eraseBtn_clicked()
|
||||||
{
|
{
|
||||||
ui->lineEdit->backspace();
|
ui->lineEdit->backspace();
|
||||||
QString text = ui->lineEdit->text();
|
QString text = ui->lineEdit->text();
|
||||||
global::keyboard::keypadText = text;
|
global::keyboard::keyboardText = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void virtualkeyboard::on_spt_clicked()
|
void virtualkeyboard::on_spt_clicked()
|
||||||
|
|
Loading…
Reference in a new issue