mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
#include <thread>
|
|
#include <condition_variable>
|
|
|
|
#include "Common/UI/View.h"
|
|
#include "Common/UI/PopupScreens.h"
|
|
#include "Core/Config.h" // for AdhocServerListEntry!
|
|
#include "Common/UI/Notice.h"
|
|
|
|
class AdhocServerScreen : public UI::PopupScreen {
|
|
public:
|
|
AdhocServerScreen(std::string *value, std::string_view title);
|
|
~AdhocServerScreen();
|
|
|
|
void CreatePopupContents(UI::ViewGroup *parent) override;
|
|
|
|
const char *tag() const override { return "AdhocServer"; }
|
|
|
|
protected:
|
|
void OnCompleted(DialogResult result) override;
|
|
bool CanComplete(DialogResult result) override;
|
|
virtual UI::Size PopupWidth() const { return 650; }
|
|
|
|
void sendMessage(UIMessage message, const char *value) override;
|
|
|
|
private:
|
|
void ResolverThread();
|
|
|
|
enum class ResolverState {
|
|
WAITING,
|
|
QUEUED,
|
|
PROGRESS,
|
|
READY,
|
|
QUIT,
|
|
};
|
|
|
|
std::string *value_;
|
|
std::string editValue_;
|
|
NoticeView *progressView_ = nullptr;
|
|
|
|
std::thread resolver_;
|
|
ResolverState resolverState_ = ResolverState::WAITING;
|
|
std::mutex resolverLock_;
|
|
std::condition_variable resolverCond_;
|
|
std::string toResolve_ = "";
|
|
bool toResolveResult_ = false;
|
|
std::string lastResolved_ = "";
|
|
bool lastResolvedResult_ = false;
|
|
};
|
|
|