added Add Image Button

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@415 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-03-25 12:28:13 +00:00
parent f39e7819e6
commit 96ee910c5f
5 changed files with 63 additions and 1 deletions

View File

@ -130,6 +130,7 @@
<file>images/loadcert16.png</file>
<file>images/locale.png</file>
<file>images/lphoto.png</file>
<file>images/lphoto24.png</file>
<file>images/logobar/logo_bar_fill.png</file>
<file>images/logobar/logo_bar_start.png</file>
<file>images/logobar/rslogo.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -51,6 +51,7 @@
#include <QTextCursor>
#include <QTextList>
#include <QTextStream>
#include <QTextDocumentFragment>
/** 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("<p><img src=\"%1\" />").arg(urlremoteorlocal);
///////////subtext.append("<br/><br/>Description on image.</p>");
QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(subtext);
ui.msgText->textCursor().insertFragment(fragment);
//emit statusMessage(QString("Image new :").arg(urlremoteorlocal));
//}
}

View File

@ -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 */

View File

@ -278,6 +278,28 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item row="0" column="8" >
<widget class="QPushButton" name="imagebtn" >
<property name="minimumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip" >
<string>Add a Image</string>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" >