diff --git a/doomsday/tools/shell/shell-text/src/cursesapp.cpp b/doomsday/tools/shell/shell-text/src/cursesapp.cpp index 7465103eb6..c07acbb2d9 100644 --- a/doomsday/tools/shell/shell-text/src/cursesapp.cpp +++ b/doomsday/tools/shell/shell-text/src/cursesapp.cpp @@ -82,7 +82,6 @@ struct CursesApp::Instance // Curses state: WINDOW *rootWin; de::Vector2i rootSize; - QTimer *refreshTimer; int unicodeContinuation; TextRootWidget *rootWidget; @@ -125,9 +124,7 @@ struct CursesApp::Instance // Listen for window resizing. signal(SIGWINCH, windowResized); - refreshTimer = new QTimer(&self); - QObject::connect(refreshTimer, SIGNAL(timeout()), &self, SLOT(refresh())); - refreshTimer->start(1000 / 30); + requestRefresh(); } void initCursesState() @@ -149,9 +146,6 @@ struct CursesApp::Instance void shutdownCurses() { - delete refreshTimer; - refreshTimer = 0; - delwin(rootWin); rootWin = 0; @@ -159,6 +153,11 @@ struct CursesApp::Instance refresh(); } + void requestRefresh() + { + QTimer::singleShot(1000 / 30, &self, SLOT(refresh())); + } + void handleResize() { // Terminal has been resized. @@ -180,6 +179,9 @@ struct CursesApp::Instance { if(!rootWin) return; + // Schedule the next refresh. + requestRefresh(); + // Update time. clock.setTime(de::Time()); @@ -335,6 +337,8 @@ struct CursesApp::Instance } } + rootWidget->update(); + // Automatically redraw the UI if the values of layout rules have changed. if(de::Rule::invalidRulesExist() || rootWidget->drawWasRequested()) { @@ -348,11 +352,6 @@ struct CursesApp::Instance wrefresh(rootWin); } } - - void update() - { - rootWidget->draw(); - } }; CursesApp::CursesApp(int &argc, char **argv) diff --git a/doomsday/tools/shell/shell-text/src/shellapp.cpp b/doomsday/tools/shell/shell-text/src/shellapp.cpp index 1bae27c96e..166d9c938a 100644 --- a/doomsday/tools/shell/shell-text/src/shellapp.cpp +++ b/doomsday/tools/shell/shell-text/src/shellapp.cpp @@ -47,7 +47,7 @@ struct ShellApp::Instance // Status bar in the bottom of the view. status = new StatusWidget; status->rule() - .setInput(RuleRectangle::Height, refless(new ConstantRule(1))) + .setInput(RuleRectangle::Height, *refless(new ConstantRule(1))) .setInput(RuleRectangle::Bottom, root.viewBottom()) .setInput(RuleRectangle::Width, root.viewWidth()) .setInput(RuleRectangle::Left, root.viewLeft()); @@ -55,15 +55,16 @@ struct ShellApp::Instance // Menu button at the left edge. menuLabel = new LabelWidget; menuLabel->setAlignment(AlignTop); - menuLabel->setLabel(" F9:Menu "); + menuLabel->setLabel(tr(" F9:Menu ")); menuLabel->setAttribs(TextCanvas::Char::Bold); menuLabel->rule() .setInput(RuleRectangle::Left, root.viewLeft()) - .setInput(RuleRectangle::Width, refless(new ConstantRule(menuLabel->label().size()))) + .setInput(RuleRectangle::Width, *refless(new ConstantRule(menuLabel->label().size()))) .setInput(RuleRectangle::Bottom, status->rule().top()); menuLabel->addAction(new Action(KeyEvent(Qt::Key_F9), &self, SLOT(openMenu()))); menuLabel->addAction(new Action(KeyEvent(Qt::Key_Z, KeyEvent::Control), &self, SLOT(openMenu()))); + menuLabel->addAction(new Action(KeyEvent(Qt::Key_X, KeyEvent::Control), &self, SLOT(openMenu()))); menuLabel->addAction(new Action(KeyEvent(Qt::Key_C, KeyEvent::Control), &self, SLOT(openMenu()))); // Expanding command line widget. @@ -86,15 +87,15 @@ struct ShellApp::Instance // Main menu. menu = new MenuWidget; menu->hide(); // closed initially - menu->appendItem(new Action("Connect to...", - KeyEvent(Qt::Key_O), + menu->appendItem(new Action(tr("Connect to..."), + KeyEvent("o"), &self, SLOT(openConnection())), "O"); - menu->appendItem(new Action("Disconnect")); + menu->appendItem(new Action(tr("Disconnect"))); menu->appendSeparator(); - menu->appendItem(new Action("Start new server")); + menu->appendItem(new Action(tr("Start new server"))); menu->appendSeparator(); - menu->appendItem(new Action("About")); - menu->appendItem(new Action("Quit Shell", + menu->appendItem(new Action(tr("About"))); + menu->appendItem(new Action(tr("Quit Shell"), KeyEvent(Qt::Key_X, KeyEvent::Control), &self, SLOT(quit())), "Ctrl-X"); menu->rule()