forked from Green-Sky/tomato
add file dropping support
This commit is contained in:
parent
b9d4f594ce
commit
2a5937652e
@ -415,6 +415,12 @@ void ChatGui4::render(void) {
|
|||||||
_msg_tc.workLoadQueue();
|
_msg_tc.workLoadQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatGui4::sendFilePath(const char* file_path) {
|
||||||
|
if (_selected_contact && std::filesystem::is_regular_file(file_path)) {
|
||||||
|
_rmm.sendFilePath(*_selected_contact, std::filesystem::path(file_path).filename().u8string(), file_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// has MessageText
|
// has MessageText
|
||||||
void ChatGui4::renderMessageBodyText(Message3Registry& reg, const Message3 e) {
|
void ChatGui4::renderMessageBodyText(Message3Registry& reg, const Message3 e) {
|
||||||
const auto& msgtext = reg.get<Message::Components::MessageText>(e).text;
|
const auto& msgtext = reg.get<Message::Components::MessageText>(e).text;
|
||||||
|
@ -50,6 +50,8 @@ class ChatGui4 {
|
|||||||
public:
|
public:
|
||||||
bool any_unread {false};
|
bool any_unread {false};
|
||||||
|
|
||||||
|
void sendFilePath(const char* file_path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void renderMessageBodyText(Message3Registry& reg, const Message3 e);
|
void renderMessageBodyText(Message3Registry& reg, const Message3 e);
|
||||||
void renderMessageBodyFile(Message3Registry& reg, const Message3 e);
|
void renderMessageBodyFile(Message3Registry& reg, const Message3 e);
|
||||||
|
@ -67,6 +67,12 @@ MainScreen::~MainScreen(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool MainScreen::handleEvent(SDL_Event& e) {
|
bool MainScreen::handleEvent(SDL_Event& e) {
|
||||||
|
if (e.type == SDL_EVENT_DROP_FILE) {
|
||||||
|
std::cout << "DROP FILE: " << e.drop.file << "\n";
|
||||||
|
cg.sendFilePath(e.drop.file);
|
||||||
|
return true; // TODO: forward return succ from sendFilePath()
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user