-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support paste image #593
Merged
Merged
support paste image #593
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -81,6 +81,7 @@ class DialogBase : public SessionAbstract, public sigc::trackable { | |||||||||||||||||
static gint EnclosureTreePopup(DialogBase* self, GdkEvent* event); | ||||||||||||||||||
static gboolean UpdateFileSendUI(DialogBase* dlggrp); | ||||||||||||||||||
static void RemoveSelectedEnclosure(DialogBase* self); | ||||||||||||||||||
static void OnPasteClipboard(DialogBase* self, GtkTextView* textview); | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Consider adding documentation for OnPasteClipboard Adding a brief comment or documentation for the OnPasteClipboard method in the header file can help other developers understand its purpose and usage.
Suggested change
|
||||||||||||||||||
|
||||||||||||||||||
protected: | ||||||||||||||||||
Application* app; | ||||||||||||||||||
|
@@ -91,12 +92,12 @@ class DialogBase : public SessionAbstract, public sigc::trackable { | |||||||||||||||||
|
||||||||||||||||||
GtkListStore* fileSendModel = 0; | ||||||||||||||||||
|
||||||||||||||||||
GData* widset; //窗体集 | ||||||||||||||||||
GData* mdlset; //数据model集 | ||||||||||||||||||
GData* dtset; //通用数据集 | ||||||||||||||||||
GroupInfo* grpinf; //群组信息 | ||||||||||||||||||
int64_t totalsendsize; //总计待发送大小(包括已发送) | ||||||||||||||||||
struct timeval lasktime; //上一次更新UI的时间 | ||||||||||||||||||
GData* widset; // 窗体集 | ||||||||||||||||||
GData* mdlset; // 数据model集 | ||||||||||||||||||
GData* dtset; // 通用数据集 | ||||||||||||||||||
GroupInfo* grpinf; // 群组信息 | ||||||||||||||||||
int64_t totalsendsize; // 总计待发送大小(包括已发送) | ||||||||||||||||||
struct timeval lasktime; // 上一次更新UI的时间 | ||||||||||||||||||
guint timersend; // 发送文件界面更新计时器ID | ||||||||||||||||||
}; | ||||||||||||||||||
|
||||||||||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,42 @@ | ||
#include "Application.h" | ||
#include "gtest/gtest.h" | ||
|
||
#include "iptux-utils/TestHelper.h" | ||
#include "iptux/DialogPeer.h" | ||
#include "iptux/TestHelper.h" | ||
#include "iptux/UiCoreThread.h" | ||
|
||
using namespace std; | ||
using namespace iptux; | ||
|
||
static void do_action(DialogPeer* w, const char* name) { | ||
GActionMap* m = G_ACTION_MAP(w->getWindow()); | ||
g_action_activate(g_action_map_lookup_action(m, name), NULL); | ||
} | ||
|
||
TEST(DialogPeer, Constructor) { | ||
Application* app = CreateApplication(); | ||
|
||
PPalInfo pal = make_shared<PalInfo>("127.0.0.1", 2425); | ||
app->getCoreThread()->AttachPalToList(pal); | ||
|
||
GroupInfo* grpinf = app->getCoreThread()->GetPalRegularItem(pal.get()); | ||
DialogPeer::PeerDialogEntry(app, grpinf); | ||
DialogPeer* dlgpr = new DialogPeer(app, grpinf); | ||
|
||
auto clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); | ||
gtk_clipboard_set_text(clipboard, "hello world", -1); | ||
do_action(dlgpr, "paste"); | ||
|
||
GError* error = NULL; | ||
auto pixbuf = | ||
gdk_pixbuf_new_from_file(testDataPath("iptux.png").c_str(), &error); | ||
if (error != nullptr) { | ||
ASSERT_TRUE(false) << error->message; | ||
g_error_free(error); | ||
} | ||
gtk_clipboard_set_image(clipboard, pixbuf); | ||
do_action(dlgpr, "paste"); | ||
g_object_unref(pixbuf); | ||
|
||
DestroyApplication(app); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Consider adding logging for clipboard operations
Adding logging statements within the OnPasteClipboard method can help in tracking clipboard operations and diagnosing issues if the clipboard content is not pasted correctly.