File indexing completed on 2025-01-12 06:47:29
0001 // 0002 // 0003 // C++ Implementation: cprompt 0004 // 0005 // Description: 0006 // 0007 /* 0008 Copyright 2003-2011 Tomas Mecir <kmuddy@kmuddy.com> 0009 0010 This program is free software; you can redistribute it and/or 0011 modify it under the terms of the GNU General Public License as 0012 published by the Free Software Foundation; either version 2 of 0013 the License, or (at your option) any later version. 0014 0015 This program is distributed in the hope that it will be useful, 0016 but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 GNU General Public License for more details. 0019 0020 You should have received a copy of the GNU General Public License 0021 along with this program. If not, see <http://www.gnu.org/licenses/>. 0022 */ 0023 0024 #include "cprompt.h" 0025 #include "cprofilesettings.h" 0026 0027 cPrompt::cPrompt(int sess, QWidget *parent) : 0028 QLabel (parent), cActionBase ("prompt", sess) 0029 { 0030 0031 addEventHandler ("got-prompt", 50, PT_STRING); 0032 addEventHandler ("settings-changed", 50, PT_NOTHING); 0033 } 0034 0035 cPrompt::~cPrompt() 0036 { 0037 removeEventHandler ("got-prompt"); 0038 removeEventHandler ("settings-changed"); 0039 } 0040 0041 void cPrompt::eventStringHandler (QString event, int, QString &par1, const QString &) 0042 { 0043 if (event == "got-prompt") 0044 updatePrompt (par1); 0045 } 0046 0047 void cPrompt::eventNothingHandler (QString event, int) 0048 { 0049 if (event == "settings-changed") { 0050 // show/hide this widget based on whether we want the prompt label or not 0051 settings()->getBool ("prompt-label") ? show() : hide(); 0052 } 0053 } 0054 0055 void cPrompt::updatePrompt(const QString &text) 0056 { 0057 setText (text); 0058 } 0059 0060 #include "moc_cprompt.cpp"