MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / uploadPaste

Method uploadPaste

launcher/ui/GuiUtil.cpp:78–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78QString GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget)
79{
80 ProgressDialog dialog(parentWidget);
81 auto pasteTypeSetting = static_cast<PasteUpload::PasteType>(APPLICATION->settings()->get("PastebinType").toInt());
82 auto pasteCustomAPIBaseSetting = APPLICATION->settings()->get("PastebinCustomAPIBase").toString();
83 std::unique_ptr<PasteUpload> paste(new PasteUpload(parentWidget, text, pasteCustomAPIBaseSetting, pasteTypeSetting));
84
85 dialog.execWithTask(paste.get());
86 if (!paste->wasSuccessful())
87 {
88 CustomMessageBox::selectable(
89 parentWidget,
90 QObject::tr("Upload failed"),
91 paste->failReason(),
92 QMessageBox::Critical
93 )->exec();
94 return QString();
95 }
96 else
97 {
98 const QString link = paste->pasteLink();
99 setClipboardText(link);
100 CustomMessageBox::selectable(
101 parentWidget, QObject::tr("Upload finished"),
102 QObject::tr("The <a href=\"%1\">link to the uploaded log</a> has been placed in your clipboard.").arg(link),
103 QMessageBox::Information)->exec();
104 return link;
105 }
106}
107
108void GuiUtil::setClipboardText(const QString &text)
109{

Callers

nothing calls this directly

Calls 10

selectableFunction · 0.85
QStringClass · 0.85
execWithTaskMethod · 0.80
wasSuccessfulMethod · 0.80
failReasonMethod · 0.80
pasteLinkMethod · 0.80
getMethod · 0.45
settingsMethod · 0.45
toStringMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected