MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / processImageSrc

Method processImageSrc

src/gui/documentviewer/WizEditorToolBar.cpp:2803–2842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2801}
2802
2803bool WizEditorToolBar::processImageSrc(bool bUseForCopy, bool& bNeedSubsequent)
2804{
2805 if (m_strImageSrc.isEmpty())
2806 {
2807 bNeedSubsequent = true;
2808 return true;
2809 }
2810
2811 //FIXME: check file URI scheme is correct or not?
2812 if (m_strImageSrc.left(7) == "file://")
2813 {
2814 m_strImageSrc.remove(0, 7);
2815 bNeedSubsequent = true;
2816 return true;
2817 }
2818 else if (m_strImageSrc.left(7) == "http://")
2819 {
2820 QFileInfo info(m_strImageSrc);
2821 QString fileName = WizGenGUIDLowerCaseLetterOnly() + "." + info.suffix();
2822 WizFileDownloader* downloader = new WizFileDownloader(m_strImageSrc, fileName, "", true);
2823 if (bUseForCopy)
2824 {
2825 connect(downloader, SIGNAL(downloadDone(QString,bool)), SLOT(copyImage(QString)));
2826 }
2827 else
2828 {
2829 connect(downloader, SIGNAL(downloadDone(QString,bool)), SLOT(saveImage(QString)));
2830 }
2831 downloader->startDownload();
2832 bNeedSubsequent = false;
2833 }
2834 else if (m_strImageSrc.left(12) == "data:image/.")
2835 {
2836 if (!processBase64Image(bUseForCopy))
2837 return false;
2838 bNeedSubsequent = false;
2839 }
2840
2841 return true;
2842}
2843
2844bool WizEditorToolBar::processBase64Image(bool bUseForCopy)
2845{

Callers

nothing calls this directly

Calls 4

isEmptyMethod · 0.80
removeMethod · 0.45
startDownloadMethod · 0.45

Tested by

no test coverage detected