26 #include <ncursesw/curses.h> 28 #define YUILogComponent "ncurses" 29 #include <yui/YUILog.h> 31 #include "YNCursesUI.h" 32 #include "NCApplication.h" 33 #include "NCAskForDirectory.h" 34 #include "NCAskForFile.h" 50 const std::string & encoding )
56 setlocale( LC_NUMERIC,
"C" );
59 yuiDebug() <<
"Language: " << language <<
" Encoding: " << (( encoding !=
"" ) ? encoding :
"NOT SET" ) << std::endl;
66 const std::string & filter,
67 const std::string & headline )
70 YUI_CHECK_NEW( filePopup );
73 YDialog::deleteTopmostDialog();
75 yuiMilestone() <<
"Returning: " << retEvent.result << std::endl;
76 return retEvent.result;
82 const std::string & filter,
83 const std::string & headline )
86 YUI_CHECK_NEW( filePopup );
89 YDialog::deleteTopmostDialog();
91 yuiMilestone() <<
"Returning: " << retEvent.result << std::endl;
92 return retEvent.result;
98 const std::string & headline )
101 YUI_CHECK_NEW( dirPopup );
104 YDialog::deleteTopmostDialog();
106 yuiMilestone() <<
"Returning: " << retEvent.result << std::endl;
107 return retEvent.result;
136 std::string cmd =
"/bin/dumpkeys | /bin/loadkeys --unicode";
138 if ( NCstring::terminalEncoding() ==
"UTF-8" )
140 int ret = system(( cmd +
" >/dev/null 2>&1" ).c_str() );
144 yuiError() <<
"ERROR: /bin/dumpkeys | /bin/loadkeys --unicode returned: " << ret << std::endl;
153 const std::string & font,
154 const std::string & screen_map,
155 const std::string & unicode_map,
156 const std::string & language )
173 NCApplication::closeUI() {
203 ret = system( cmd.c_str() );
207 yuiError() << cmd <<
" returned:" << ret << std::endl;
217 NCApplication::displayWidth()
224 NCApplication::displayHeight()
231 NCApplication::displayDepth()
238 NCApplication::displayColors()
240 return NCattribute::colors();
245 NCApplication::defaultWidth()
252 NCApplication::defaultHeight()
259 NCApplication::hasFullUtf8Support()
261 return ( NCstring::terminalEncoding() ==
"UTF-8" );
266 YApplication::setApplicationTitle ( title );
267 NCurses::SetTitle(title);
virtual std::string askForSaveFileName(const std::string &startWith, const std::string &filter, const std::string &headline)
Open a file selection box and prompt the user for a file to save data to.
virtual void setApplicationTitle(const std::string &title)
Set the application title.
virtual void redrawScreen()
Redraw the screen.
virtual void setConsoleFont(const std::string &console_magic, const std::string &font, const std::string &screen_map, const std::string &unicode_map, const std::string &lang)
Set the (text) console font according to the current encoding etc.
virtual ~NCApplication()
Destructor.
virtual int runInTerminal(const std::string &command)
Run a shell command (typically an interactive program using NCurses) in a terminal (window)...
static YNCursesUI * ui()
Access the global Y2NCursesUI.
virtual void initConsoleKeyboard()
Initialize the (text) console keyboard.
virtual void setLanguage(const std::string &language, const std::string &encoding=std::string())
Set language and encoding for the locale environment ($LANG).
NCApplication()
Constructor.
virtual std::string askForExistingDirectory(const std::string &startDir, const std::string &headline)
Open a directory selection box and prompt the user for an existing directory.
virtual void openUI() override
To mix TUI (NCurses) with stdio, enclose the UI parts within openUI/closeUI.
NCursesEvent & showDirPopup()
Shows the popup with the std::list of directories.
NCursesEvent & showDirPopup()
Shows the popup with the std::list of directories.
virtual std::string askForExistingFile(const std::string &startWith, const std::string &filter, const std::string &headline)
Open a file selection box and prompt the user for an existing file.
virtual void setConsoleFont(const std::string &console_magic, const std::string &font, const std::string &screen_map, const std::string &unicode_map, const std::string &language)
Set the (text) console font according to the current encoding etc.