From 96ee910c5f145c2d3ba9822a49e14ed433490366 Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 25 Mar 2008 12:28:13 +0000 Subject: [PATCH] added Add Image Button git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@415 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/images.qrc | 1 + retroshare-gui/src/gui/images/lphoto24.png | Bin 0 -> 1859 bytes retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp | 32 ++++++++++++++++++ retroshare-gui/src/gui/msgs/ChanMsgDialog.h | 9 ++++- retroshare-gui/src/gui/msgs/ChanMsgDialog.ui | 22 ++++++++++++ 5 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 retroshare-gui/src/gui/images/lphoto24.png diff --git a/retroshare-gui/src/gui/images.qrc b/retroshare-gui/src/gui/images.qrc index 6a60caef1..01799dd03 100644 --- a/retroshare-gui/src/gui/images.qrc +++ b/retroshare-gui/src/gui/images.qrc @@ -130,6 +130,7 @@ images/loadcert16.png images/locale.png images/lphoto.png + images/lphoto24.png images/logobar/logo_bar_fill.png images/logobar/logo_bar_start.png images/logobar/rslogo.png diff --git a/retroshare-gui/src/gui/images/lphoto24.png b/retroshare-gui/src/gui/images/lphoto24.png new file mode 100644 index 0000000000000000000000000000000000000000..4eb197db1f5e4611843ae7248aee4b4e79b1ea8f GIT binary patch literal 1859 zcmV-J2fX-+P)D7-0Q|K6dWBmCH+8dp`xt|R!whfU zLf?h~dizJX_d9nLHm>g(UcbI?d~|f{u160&@n{rACmgNO02Yfe27o9GN#YQj#9$M| z#w1aT{!JS)#bTiyVJkKsw@J8*B-j`>s_m~HJ&{{Za{d=9BDW2BOnox7m`Y_%XxBv> zV=zff95gAHiYi|yb_$FNX3Qqh_9SYK1&yUmN8bETo>a-JB}!kcSU#JNm|6;1y3(Sy zS|^BCXa&N;o(=T(-?VAnx-womgZ4c4XF;=ZPi?u<_tx==Znw~ztH;V+Xb2asB^;hz zX8x0qMyo{-UxGM6DZ$l(>j<89DEJDUaS0PeD-i~VHgEjlPwodm@BQZ2zjw>MKi~b> zOH0(xHmR@95yc6{7+eLO3!YNsTtzV@IN~BAh;mR0lyVRSN@=umsJ39|@U|WSv0(M- z4=4UTb}iX`{!*3BJhWvj3JuC42ui>aLBv6n1?3=0P>$dz1&*MULWu&UX@t&Y2@O&Y=4(g4BQ}4XT(S;O)!<)xk&qKGuD7t)cy4u$@T&S;lq#T3eti_;w4{Z&Z zlTUGG@+{^19_Hqe5+(#JC=GrV!q{-?jaQg@?XR4hJVyHNeQX}vu{EDBpq_r}FHCU{6mcxkTaRayWj9>(v$d+e(aV+E_}Z(!P4(AFr`eZ@r(1 z5{k(@?#cy$5W+GXy_RsMDSZ9YCVK`p3JsZ{CgD==T55r$T5^D@`9I>*pf+zuN zSzQfSZLQL3HVK0OV+=z>!@Tg!OZ@T4KM(~Gcb~b3-#_v&Tl`)8>c@|*BB_PXKf5w> z`Rx4EuU~&`>g2@nWBU5_3f5XcFvg%olNdu1hs0q>6h#CMz8%Y5~YahAu%I5{zi=V~g~DojqEJT-syYQ=Ls5|a?e35hX) zMc;Yn?vzOqwAM76O#qZq*u)aYAtDe&5hjT#6!WB09+}=QwntmgTBAf39z1a1TQ?64 z;kqtLgt4tV_|u^$){;4R@ZhZ`G0$W&>2kGN^{ur!i4zqYLmY*KVMvk~j5S~_ahxC` zquU@^HT3lT8>h-!CMUm24oAz>h{MpQf;QZ{lAo7TI x4cwCK-~WIPgFp@)dc5Yku62|GxzTb;@n1g&9f2II|M>s_002ovPDHLkV1gMXi-7 #include #include +#include /** Constructor */ @@ -78,6 +79,7 @@ ChanMsgDialog::ChanMsgDialog(bool msg, QWidget *parent, Qt::WFlags flags) connect(ui.underlinebtn, SIGNAL(clicked()), this, SLOT(textUnderline())); connect(ui.italicbtn, SIGNAL(clicked()), this, SLOT(textItalic())); connect(ui.colorbtn, SIGNAL(clicked()), this, SLOT(textColor())); + connect(ui.imagebtn, SIGNAL(clicked()), this, SLOT(addImage())); connect(ui.actionContactsView, SIGNAL(triggered()), this, SLOT(toggleContacts())); connect(ui.actionSaveas, SIGNAL(triggered()), this, SLOT(fileSaveAs())); @@ -177,6 +179,7 @@ ChanMsgDialog::ChanMsgDialog(bool msg, QWidget *parent, Qt::WFlags flags) ui.underlinebtn->setIcon(QIcon(QString(":/images/textedit/textitalic.png"))); ui.italicbtn->setIcon(QIcon(QString(":/images/textedit/textunder.png"))); ui.textalignmentbtn->setIcon(QIcon(QString(":/images/textedit/textcenter.png"))); + ui.imagebtn->setIcon(QIcon(QString(":/images/lphoto24.png"))); ui.actionContactsView->setIcon(QIcon(":/images/contacts24.png")); ui.actionSaveas->setIcon(QIcon(":/images/save24.png")); @@ -988,3 +991,32 @@ void ChanMsgDialog::toggleContacts() ui.contactsdockWidget->setVisible(!ui.contactsdockWidget->isVisible()); } +void ChanMsgDialog::addImage() +{ + + QString fileimg = QFileDialog::getOpenFileName( this, tr( "Choose Image" ), + QString(setter.value("LastDir").toString()) ,tr("Image Files supported (*.png *.jpeg *.jpg *.gif)")); + + if ( fileimg.isEmpty() ) { + return; + } + + QImage base(fileimg); + + QString pathimage = fileimg.left(fileimg.lastIndexOf("/"))+"/"; + setter.setValue("LastDir",pathimage); + + Create_New_Image_Tag(fileimg); +} + +void ChanMsgDialog::Create_New_Image_Tag( const QString urlremoteorlocal ) +{ + /*if (image_extension(urlremoteorlocal)) {*/ + QString subtext = QString("

").arg(urlremoteorlocal); + ///////////subtext.append("

Description on image.

"); + QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(subtext); + ui.msgText->textCursor().insertFragment(fragment); + //emit statusMessage(QString("Image new :").arg(urlremoteorlocal)); + //} +} + diff --git a/retroshare-gui/src/gui/msgs/ChanMsgDialog.h b/retroshare-gui/src/gui/msgs/ChanMsgDialog.h index b73c9e1d2..c6c77474d 100644 --- a/retroshare-gui/src/gui/msgs/ChanMsgDialog.h +++ b/retroshare-gui/src/gui/msgs/ChanMsgDialog.h @@ -55,12 +55,15 @@ void insertChannelSendList(); /* for Channels */ void insertFileList(); /* for Both */ void insertTitleText(std::string title); void insertMsgText(std::string msg); +void Create_New_Image_Tag( const QString urlremoteorlocal ); + QSettings setter; public slots: /* actions to take.... */ void sendMessage(); void cancelMessage(); +void addImage(); protected: void closeEvent (QCloseEvent * event); @@ -86,7 +89,9 @@ private slots: void fileOpen(); bool fileSave(); bool fileSaveAs(); - void filePrint(); + void filePrint(); + + //void filePrintPreview(); void filePrintPdf(); @@ -110,6 +115,7 @@ private: void setupEditActions(); bool load(const QString &f); bool maybeSave(); + //bool image_extension( QString nametomake ); void setCurrentFileName(const QString &fileName); void mergeFormatOnWordOrSelection(const QTextCharFormat &format); @@ -138,6 +144,7 @@ private: QTreeView *channelstreeView; QString fileName; + QString nametomake; bool mIsMsg; /* different behaviour for Msg or ChanMsg */ diff --git a/retroshare-gui/src/gui/msgs/ChanMsgDialog.ui b/retroshare-gui/src/gui/msgs/ChanMsgDialog.ui index afae1d35e..0b8c3ee7e 100644 --- a/retroshare-gui/src/gui/msgs/ChanMsgDialog.ui +++ b/retroshare-gui/src/gui/msgs/ChanMsgDialog.ui @@ -278,6 +278,28 @@ p, li { white-space: pre-wrap; } + + + + + 24 + 24 + + + + + 24 + 24 + + + + Add a Image + + + + + +