Subversion Repositories tpanel

Rev

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

Rev 71 Rev 111
Line 1... Line 1...
1
/*
1
/*
2
 * Copyright (C) 2021 by Andreas Theofilu <andreas@theosys.at>
2
 * Copyright (C) 2021, 2022 by Andreas Theofilu <andreas@theosys.at>
3
 *
3
 *
4
 * This program is free software; you can redistribute it and/or modify
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
7
 * (at your option) any later version.
Line 22... Line 22...
22
#include "tqkeyboard.h"
22
#include "tqkeyboard.h"
23
#include "ui_keyboard.h"
23
#include "ui_keyboard.h"
24
#include "terror.h"
24
#include "terror.h"
25
#include "tresources.h"
25
#include "tresources.h"
26
#include "tconfig.h"
26
#include "tconfig.h"
-
 
27
#include "tpagemanager.h"
-
 
28
 
-
 
29
extern TPageManager *gPageManager;              //!< The pointer to the global defined main class.
27
 
30
 
28
TQKeyboard::TQKeyboard(const std::string& init, const std::string& prompt, QWidget *parent, bool priv)
31
TQKeyboard::TQKeyboard(const std::string& init, const std::string& prompt, QWidget *parent, bool priv)
29
    : QDialog(parent),
32
    : QDialog(parent),
30
      TSystemSound(TConfig::getSystemPath(TConfig::SOUNDS)),
33
      TSystemSound(TConfig::getSystemPath(TConfig::SOUNDS)),
31
      ui(new Ui::TQKeyboard),
34
      ui(new Ui::TQKeyboard),
Line 224... Line 227...
224
        mShift = false;
227
        mShift = false;
225
 
228
 
226
    if (key != Ui::KEY_AltGR)
229
    if (key != Ui::KEY_AltGR)
227
        mGr = false;
230
        mGr = false;
228
 
231
 
-
 
232
    if (mMaxLen > 0 && mText.length() > (size_t)mMaxLen)
-
 
233
        mText = mText.substr(0, mMaxLen);
-
 
234
 
229
    if (!mPrivate)
235
    if (!mPrivate)
230
        ui->label_TextLine->setText(mText.c_str());
236
        ui->label_TextLine->setText(mText.c_str());
231
    else
237
    else
232
        ui->label_TextLine->setText(fillString('*', mText.length()).c_str());
238
        ui->label_TextLine->setText(fillString('*', mText.length()).c_str());
233
 
239
 
Line 235... Line 241...
235
    {
241
    {
236
        std::string snd = getTouchFeedbackSound();
242
        std::string snd = getTouchFeedbackSound();
237
        MSG_DEBUG("Playing sound: " << snd);
243
        MSG_DEBUG("Playing sound: " << snd);
238
        QSound::play(snd.c_str());
244
        QSound::play(snd.c_str());
239
    }
245
    }
-
 
246
 
-
 
247
    if (gPageManager && gPageManager->getPassThrough() && !mText.empty() &&
-
 
248
        key != Ui::KEY_Backspace && key != Ui::KEY_Clear &&
-
 
249
        key != Ui::KEY_Shift && key != Ui::KEY_AltGR && key != Ui::KEY_Caps)
-
 
250
    {
-
 
251
        size_t pos = mText.length() - 1;
-
 
252
        gPageManager->sendKeyStroke(mText[pos]);
-
 
253
    }
-
 
254
}
-
 
255
 
-
 
256
void TQKeyboard::setString(const std::string& str)
-
 
257
{
-
 
258
    DECL_TRACER("TQKeyboard::setString(const string& str)");
-
 
259
 
-
 
260
    mText += str;
-
 
261
 
-
 
262
    if (mMaxLen > 0 && mText.length() > (size_t)mMaxLen)
-
 
263
        mText = mText.substr(0, mMaxLen);
-
 
264
 
-
 
265
    if (!mPrivate)
-
 
266
        ui->label_TextLine->setText(mText.c_str());
-
 
267
    else
-
 
268
        ui->label_TextLine->setText(fillString('*', mText.length()).c_str());
240
}
269
}
241
 
270
 
242
int TQKeyboard::scale(int value)
271
int TQKeyboard::scale(int value)
243
{
272
{
244
    if (value <= 0 || mScaleFactor == 1.0)
273
    if (value <= 0 || mScaleFactor == 1.0)