mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
VNC viewer support
This commit is contained in:
parent
13803ef333
commit
87e133b8d6
8 changed files with 82 additions and 12 deletions
24
apps.cpp
24
apps.cpp
|
@ -26,17 +26,15 @@ apps::apps(QWidget *parent) :
|
|||
ui->vncLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
||||
|
||||
// Hiding KoBox apps button and label if X11 isn't enabled/wasn't started
|
||||
if(checkconfig("/external_root/boot/flags/X11_START") != true) {
|
||||
ui->label_5->hide();
|
||||
ui->koboxAppsOpenButton->hide();
|
||||
ui->label_5->deleteLater();
|
||||
ui->koboxAppsOpenButton->deleteLater();
|
||||
}
|
||||
if(checkconfig("/external_root/boot/flags/X11_START") != true) {
|
||||
if(checkconfig("/external_root/boot/flags/X11_START") == false) {
|
||||
ui->label_5->hide();
|
||||
ui->koboxAppsOpenButton->hide();
|
||||
ui->label_5->deleteLater();
|
||||
ui->koboxAppsOpenButton->deleteLater();
|
||||
ui->vncViewerLabel->hide();
|
||||
ui->vncLaunchBtn->hide();
|
||||
ui->vncViewerLabel->deleteLater();
|
||||
ui->vncLaunchBtn->deleteLater();
|
||||
}
|
||||
|
||||
QFile stylesheetFile(":/resources/eink.qss");
|
||||
|
@ -98,5 +96,15 @@ void apps::on_koboxAppsOpenButton_clicked()
|
|||
|
||||
void apps::on_vncLaunchBtn_clicked()
|
||||
{
|
||||
|
||||
global::keyboard::keyboardDialog = true;
|
||||
global::keyboard::vncDialog = true;
|
||||
global::keyboard::keyboardText = "";
|
||||
generalDialogWindow = new generalDialog();
|
||||
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(generalDialogWindow, SIGNAL(refreshScreen()), SLOT(refreshScreenNative()));
|
||||
generalDialogWindow->show();
|
||||
}
|
||||
|
||||
void apps::refreshScreenNative() {
|
||||
emit refreshScreen();
|
||||
}
|
||||
|
|
7
apps.h
7
apps.h
|
@ -26,16 +26,19 @@ private slots:
|
|||
void on_savedWordsLaunchBtn_clicked();
|
||||
void on_calendarLaunchBtn_clicked();
|
||||
void on_calculatorLaunchBtn_clicked();
|
||||
|
||||
void on_koboxAppsOpenButton_clicked();
|
||||
|
||||
void on_vncLaunchBtn_clicked();
|
||||
void refreshScreenNative();
|
||||
|
||||
private:
|
||||
Ui::apps *ui;
|
||||
savedwords *savedWordsWindow;
|
||||
calendarApp *calendarWindow;
|
||||
koboxAppsDialog *koboxAppsDialogWindow;
|
||||
generalDialog *generalDialogWindow;
|
||||
|
||||
signals:
|
||||
void refreshScreen();
|
||||
};
|
||||
|
||||
#endif // APPS_H
|
||||
|
|
|
@ -63,6 +63,7 @@ namespace global {
|
|||
inline bool keyboardDialog;
|
||||
inline bool keypadDialog;
|
||||
inline bool searchDialog;
|
||||
inline bool vncDialog;
|
||||
inline QString keyboardText;
|
||||
inline QString keypadText;
|
||||
}
|
||||
|
|
|
@ -239,6 +239,32 @@ void generalDialog::on_okBtn_clicked()
|
|||
QMessageBox::critical(this, tr("Invalid argument"), tr("Please type in a search term."));
|
||||
}
|
||||
}
|
||||
else if(global::keyboard::vncDialog == true) {
|
||||
if(global::keyboard::keyboardText != "") {
|
||||
if(vncServerSet != true) {
|
||||
vncServerAddress = global::keyboard::keyboardText;
|
||||
vncServerSet = true;
|
||||
keyboardWidget->clearLineEdit();
|
||||
ui->headerLabel->setText("Enter the server's password");
|
||||
}
|
||||
else if(vncPasswordSet != true) {
|
||||
vncServerPassword = global::keyboard::keyboardText;
|
||||
vncPasswordSet = true;
|
||||
keyboardWidget->clearLineEdit();
|
||||
ui->headerLabel->setText("Enter the server's port");
|
||||
}
|
||||
else {
|
||||
vncServerPort = global::keyboard::keyboardText;
|
||||
global::keyboard::vncDialog = false;
|
||||
global::keyboard::keyboardDialog = false;
|
||||
startVNC(vncServerAddress, vncServerPassword, vncServerPort);
|
||||
generalDialog::close();
|
||||
}
|
||||
}
|
||||
else {
|
||||
QMessageBox::critical(this, tr("Invalid argument"), tr("Please type in the required argument."));
|
||||
}
|
||||
}
|
||||
else {
|
||||
global::keyboard::keyboardDialog = false;
|
||||
generalDialog::close();
|
||||
|
@ -291,14 +317,21 @@ void generalDialog::setupKeyboardDialog() {
|
|||
if(global::keyboard::searchDialog == true) {
|
||||
ui->topStackedWidget->setCurrentIndex(1);
|
||||
ui->searchHeaderLabel->setText("Search");
|
||||
ui->okBtn->setText("Search");
|
||||
ui->cancelBtn->setText("Close");
|
||||
}
|
||||
else if(global::keyboard::vncDialog == true) {
|
||||
ui->headerLabel->setText("Enter the server's IP address");
|
||||
ui->okBtn->setText("OK");
|
||||
ui->cancelBtn->setText("Cancel");
|
||||
}
|
||||
else {
|
||||
ui->headerLabel->setText("Enter a string");
|
||||
ui->okBtn->setText("OK");
|
||||
ui->cancelBtn->setText("Cancel");
|
||||
}
|
||||
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()));
|
||||
|
@ -307,3 +340,14 @@ void generalDialog::setupKeyboardDialog() {
|
|||
void generalDialog::refreshScreenNative() {
|
||||
emit refreshScreen();
|
||||
}
|
||||
|
||||
void generalDialog::startVNC(QString server, QString password, QString port) {
|
||||
std::string server_str = server.toStdString();
|
||||
std::string password_str = password.toStdString();
|
||||
std::string port_str = port.toStdString();
|
||||
string_writeconfig("/external_root/tmp/app_vnc_server", server_str);
|
||||
string_writeconfig("/external_root/tmp/app_vnc_password", password_str);
|
||||
string_writeconfig("/external_root/tmp/app_vnc_port", port_str);
|
||||
string_writeconfig("/opt/ibxd", "app_start_vnc");
|
||||
qApp->quit();
|
||||
}
|
||||
|
|
|
@ -33,7 +33,13 @@ public:
|
|||
bool keyboardDialog = false;
|
||||
bool keypadDialog = false;
|
||||
bool dictionaryResults = false;
|
||||
bool vncServerSet = false;
|
||||
bool vncPasswordSet = false;
|
||||
QString vncServerAddress;
|
||||
QString vncServerPassword;
|
||||
QString vncServerPort;
|
||||
void setupKeyboardDialog();
|
||||
void startVNC(QString server, QString password, QString port);
|
||||
|
||||
private slots:
|
||||
void on_cancelBtn_clicked();
|
||||
|
|
|
@ -593,6 +593,7 @@ void MainWindow::on_appsBtn_clicked()
|
|||
|
||||
// Create widget
|
||||
appsWindow = new apps();
|
||||
connect(appsWindow, SIGNAL(refreshScreen()), SLOT(refreshScreen()));
|
||||
ui->stackedWidget->insertWidget(1, appsWindow);
|
||||
global::mainwindow::tabSwitcher::appsWidgetCreated = true;
|
||||
|
||||
|
|
|
@ -594,3 +594,9 @@ void virtualkeyboard::reverseKeys() {
|
|||
void virtualkeyboard::adjust_size_function() {
|
||||
emit adjust_size();
|
||||
}
|
||||
|
||||
void virtualkeyboard::clearLineEdit() {
|
||||
ui->lineEdit->clear();
|
||||
QString text = ui->lineEdit->text();
|
||||
global::keyboard::keyboardText = text;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ public:
|
|||
~virtualkeyboard();
|
||||
bool shift;
|
||||
void reverseKeys();
|
||||
void clearLineEdit();
|
||||
|
||||
private slots:
|
||||
void on_spaceBtn_clicked();
|
||||
|
|
Loading…
Reference in a new issue