Subversion Repositories tpanel

Rev

Rev 65 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 65 Rev 71
Line 13... Line 13...
13
 *
13
 *
14
 * You should have received a copy of the GNU General Public License
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software Foundation,
15
 * along with this program; if not, write to the Free Software Foundation,
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
 */
17
 */
18
#include "QPushButton"
18
#include <QPushButton>
19
#include "QLabel"
19
#include <QLabel>
-
 
20
#include <QSound>
20
 
21
 
21
#include "tqkeypad.h"
22
#include "tqkeypad.h"
22
#include "ui_keypad.h"
23
#include "ui_keypad.h"
23
#include "terror.h"
24
#include "terror.h"
24
#include "tresources.h"
25
#include "tresources.h"
-
 
26
#include "tconfig.h"
25
 
27
 
26
TQKeypad::TQKeypad(const std::string& init, const std::string& prompt, QWidget *parent, bool priv)
28
TQKeypad::TQKeypad(const std::string& init, const std::string& prompt, QWidget *parent, bool priv)
27
    : QDialog(parent),
29
    : QDialog(parent),
-
 
30
      TSystemSound(TConfig::getSystemPath(TConfig::SOUNDS)),
28
      ui(new Ui::TQKeypad),
31
      ui(new Ui::TQKeypad),
29
      mPrivate(priv),
32
      mPrivate(priv),
30
      mText(init)
33
      mText(init)
31
{
34
{
32
    DECL_TRACER("TQKeypad::TQKeypad(const std::string& init, const std::string& prompt, QWidget *parent)");
35
    DECL_TRACER("TQKeypad::TQKeypad(const std::string& init, const std::string& prompt, QWidget *parent)");
Line 119... Line 122...
119
#endif
122
#endif
120
}
123
}
121
 
124
 
122
void TQKeypad::setKey(Ui::KEYSP_t key)
125
void TQKeypad::setKey(Ui::KEYSP_t key)
123
{
126
{
-
 
127
    DECL_TRACER("TQKeypad::setKey(Ui::KEYSP_t key)");
-
 
128
 
124
    switch(key)
129
    switch(key)
125
    {
130
    {
126
        case Ui::KEYP_0:        mText += "0"; break;
131
        case Ui::KEYP_0:        mText += "0"; break;
127
        case Ui::KEYP_1:        mText += "1"; break;
132
        case Ui::KEYP_1:        mText += "1"; break;
128
        case Ui::KEYP_2:        mText += "2"; break;
133
        case Ui::KEYP_2:        mText += "2"; break;
Line 143... Line 148...
143
 
148
 
144
    if (!mPrivate)
149
    if (!mPrivate)
145
        ui->label_TextLine->setText(mText.c_str());
150
        ui->label_TextLine->setText(mText.c_str());
146
    else
151
    else
147
        ui->label_TextLine->setText(fillString('*', mText.length()).c_str());
152
        ui->label_TextLine->setText(fillString('*', mText.length()).c_str());
-
 
153
 
-
 
154
    if (getSystemSoundState())
-
 
155
    {
-
 
156
        std::string snd = getTouchFeedbackSound();
-
 
157
        MSG_DEBUG("Playing sound: " << snd);
-
 
158
        QSound::play(snd.c_str());
-
 
159
    }
148
}
160
}
149
 
161
 
150
int TQKeypad::scale(int value)
162
int TQKeypad::scale(int value)
151
{
163
{
152
    if (value <= 0 || mScaleFactor == 1.0)
164
    if (value <= 0 || mScaleFactor == 1.0)