ui improve
This commit is contained in:
@@ -7,10 +7,13 @@ namespace ui {
|
||||
private:
|
||||
|
||||
pu::ui::elm::Menu::Ref titlesMenu;
|
||||
bool m_inputLocked = false;
|
||||
|
||||
public:
|
||||
|
||||
void InitTitles();
|
||||
void LockInput() { m_inputLocked = true; }
|
||||
void UnlockInput() { m_inputLocked = false; }
|
||||
|
||||
void onInput(u64 Down, u64 Up, u64 Held, pu::ui::TouchPoint Pos);
|
||||
|
||||
|
||||
@@ -19,17 +19,17 @@ namespace ui {
|
||||
TransferOverlay(const std::string &title)
|
||||
: Overlay(OvlX, OvlY, OvlW, OvlH, pu::ui::Color(30, 30, 30, 220))
|
||||
{
|
||||
titleText = pu::ui::elm::TextBlock::New(OvlX + 40, OvlY + 30, title);
|
||||
titleText = pu::ui::elm::TextBlock::New(40, 30, title);
|
||||
titleText->SetColor(pu::ui::Color(255, 255, 255, 255));
|
||||
|
||||
statusText = pu::ui::elm::TextBlock::New(OvlX + 40, OvlY + 90, "");
|
||||
statusText = pu::ui::elm::TextBlock::New(40, 90, "");
|
||||
statusText->SetColor(pu::ui::Color(180, 180, 180, 255));
|
||||
|
||||
progressBar = pu::ui::elm::ProgressBar::New(OvlX + 40, OvlY + 140, OvlW - 80, 20, 100.0);
|
||||
progressBar = pu::ui::elm::ProgressBar::New(40, 140, OvlW - 80, 20, 100.0);
|
||||
progressBar->SetProgressColor(pu::ui::Color(100, 180, 255, 255));
|
||||
progressBar->SetBackgroundColor(pu::ui::Color(70, 70, 70, 255));
|
||||
|
||||
hintText = pu::ui::elm::TextBlock::New(OvlX + 40, OvlY + 195, "Press B to cancel");
|
||||
hintText = pu::ui::elm::TextBlock::New(40, 195, "Press B to cancel");
|
||||
hintText->SetColor(pu::ui::Color(130, 130, 130, 255));
|
||||
|
||||
this->Add(titleText);
|
||||
@@ -40,7 +40,12 @@ namespace ui {
|
||||
PU_SMART_CTOR(TransferOverlay)
|
||||
|
||||
void SetStatus(const std::string &status) {
|
||||
statusText->SetText(status);
|
||||
static constexpr size_t MaxChars = 48;
|
||||
if (status.size() > MaxChars) {
|
||||
statusText->SetText(status.substr(0, MaxChars - 3) + "...");
|
||||
} else {
|
||||
statusText->SetText(status);
|
||||
}
|
||||
}
|
||||
|
||||
void SetProgress(double val) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
struct TransferState {
|
||||
std::atomic<bool> done{false};
|
||||
std::atomic<bool> cancelled{false};
|
||||
std::atomic<bool> connection_failed{false};
|
||||
std::atomic<uint64_t> bytes_done{0};
|
||||
std::atomic<uint64_t> bytes_total{0};
|
||||
|
||||
@@ -13,10 +14,11 @@ struct TransferState {
|
||||
mutable std::mutex status_mutex;
|
||||
|
||||
void reset() {
|
||||
done = false;
|
||||
cancelled = false;
|
||||
bytes_done = 0;
|
||||
bytes_total = 0;
|
||||
done = false;
|
||||
cancelled = false;
|
||||
connection_failed = false;
|
||||
bytes_done = 0;
|
||||
bytes_total = 0;
|
||||
std::lock_guard<std::mutex> lock(status_mutex);
|
||||
status.clear();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ using path = fs::path;
|
||||
|
||||
int transfer_files(path directory);
|
||||
bool isClientTransferDone();
|
||||
bool isClientTransferCancelled();
|
||||
bool isClientConnectionFailed();
|
||||
void cancelClientTransfer();
|
||||
double getClientProgress();
|
||||
std::string getClientStatusText();
|
||||
|
||||
Reference in New Issue
Block a user