CShellWindow: add new enum option ACKNOWLEDGE_MSG

allows to show a messagebox instead a small ok button
This commit is contained in:
2014-10-05 00:13:58 +02:00
parent 3f6eaa11a3
commit 3408dbd833
2 changed files with 24 additions and 12 deletions

View File

@@ -34,7 +34,6 @@
#include <global.h> #include <global.h>
#include <neutrino.h> #include <neutrino.h>
#include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <driver/framebuffer.h> #include <driver/framebuffer.h>
#include <gui/widget/textbox.h> #include <gui/widget/textbox.h>
@@ -43,6 +42,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <system/helpers.h> #include <system/helpers.h>
#include <gui/components/cc.h> #include <gui/components/cc.h>
#include <gui/widget/messagebox.h>
#include <errno.h> #include <errno.h>
CShellWindow::CShellWindow(const std::string &command, const int _mode, int *res) { CShellWindow::CShellWindow(const std::string &command, const int _mode, int *res) {
@@ -189,23 +189,34 @@ CShellWindow::CShellWindow(const std::string &command, const int _mode, int *res
CShellWindow::~CShellWindow() CShellWindow::~CShellWindow()
{ {
if (textBox && (mode & ACKNOWLEDGE)) { if (textBox){
int b_width = 150; bool exit = false;
int b_height = 35; if (mode & ACKNOWLEDGE){
int xpos = frameBuffer->getScreenWidth() - b_width; int b_width = 150;
int ypos = frameBuffer->getScreenHeight() - b_height; int b_height = 35;
int xpos = frameBuffer->getScreenWidth() - b_width;
int ypos = frameBuffer->getScreenHeight() - b_height;
CComponentsButton btn(xpos, ypos, b_width, b_height, LOCALE_MESSAGEBOX_OK, NEUTRINO_ICON_BUTTON_OKAY, NULL, true, true); CComponentsButton btn(xpos, ypos, b_width, b_height, LOCALE_MESSAGEBOX_OK, NEUTRINO_ICON_BUTTON_OKAY, NULL, true, true);
btn.paint(); btn.paint();
}
else if (mode & ACKNOWLEDGE_MSG){
DisplayInfoMessage("...ready. Please press OK");
exit = true;
}
frameBuffer->blit(); frameBuffer->blit();
neutrino_msg_t msg; neutrino_msg_t msg;
neutrino_msg_data_t data; neutrino_msg_data_t data;
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
do
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd); if (!exit)
while (msg != CRCInput::RC_ok && msg != CRCInput::RC_home && msg != CRCInput::RC_timeout); {
do
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd);
while (msg != CRCInput::RC_ok && msg != CRCInput::RC_home && msg != CRCInput::RC_timeout);
}
frameBuffer->Clear(); frameBuffer->Clear();
frameBuffer->blit(); frameBuffer->blit();

View File

@@ -39,7 +39,8 @@ class CShellWindow
enum shellwindow_modes enum shellwindow_modes
{ {
VERBOSE = 1, VERBOSE = 1,
ACKNOWLEDGE = 2 ACKNOWLEDGE = 2,
ACKNOWLEDGE_MSG = 4
}; };
CShellWindow(const std::string &cmd, const int mode = 0, int *res = NULL); CShellWindow(const std::string &cmd, const int mode = 0, int *res = NULL);
~CShellWindow(); ~CShellWindow();