2022-06-16 21:33:18 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include "al/async/AsyncFunctorThread.h"
|
|
|
|
#include "al/async/FunctorV0M.hpp"
|
|
|
|
|
|
|
|
#include "nn/swkbd/swkbd.h"
|
|
|
|
|
|
|
|
#include "logger.hpp"
|
|
|
|
|
2022-06-19 00:48:37 +00:00
|
|
|
typedef void (*KeyboardSetup)(nn::swkbd::KeyboardConfig&);
|
|
|
|
|
2022-06-16 21:33:18 +00:00
|
|
|
class Keyboard {
|
|
|
|
public:
|
|
|
|
Keyboard(ulong strSize);
|
|
|
|
void keyboardThread();
|
|
|
|
|
2022-06-19 00:48:37 +00:00
|
|
|
void openKeyboard(const char* initialText, KeyboardSetup setup);
|
2022-06-16 21:33:18 +00:00
|
|
|
|
|
|
|
const char* getResult() {
|
|
|
|
if (mThread->isDone()) {
|
|
|
|
return mResultString.cstr();
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
};
|
|
|
|
|
2022-07-10 01:24:00 +00:00
|
|
|
bool isKeyboardCancelled() const { return mIsCancelled; }
|
|
|
|
|
2022-06-16 21:33:18 +00:00
|
|
|
bool isThreadDone() { return mThread->isDone(); }
|
|
|
|
|
|
|
|
void setHeaderText(const char16_t* text) { mHeaderText = text; }
|
|
|
|
void setSubText(const char16_t* text) { mSubText = text; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
al::AsyncFunctorThread* mThread;
|
|
|
|
nn::swkbd::String mResultString;
|
|
|
|
|
2022-07-10 06:13:28 +00:00
|
|
|
hostname mInitialText;
|
2022-06-19 00:48:37 +00:00
|
|
|
KeyboardSetup mSetupFunc;
|
2022-06-16 21:33:18 +00:00
|
|
|
|
|
|
|
const char16_t *mHeaderText = u"Enter Server IP Here!";
|
2022-07-10 01:24:00 +00:00
|
|
|
const char16_t* mSubText = u"Must be a Valid Address.";
|
|
|
|
|
|
|
|
bool mIsCancelled = false;
|
2022-06-16 21:33:18 +00:00
|
|
|
|
|
|
|
char* mWorkBuf;
|
|
|
|
int mWorkBufSize;
|
|
|
|
char* mTextCheckBuf;
|
|
|
|
int mTextCheckSize;
|
|
|
|
char* mCustomizeDicBuf;
|
|
|
|
int mCustomizeDicSize;
|
2022-07-10 06:13:28 +00:00
|
|
|
};
|