changes to support i8n in the gui (chat and messages)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@318 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-01-26 13:08:28 +00:00
parent bfb0b2be2b
commit f9d6f1c418
9 changed files with 734 additions and 397 deletions

View File

@ -89,6 +89,7 @@ void ChatDialog::msgSendListCostumPopupMenu( QPoint point )
contextMnu.addAction( privchatAct);
contextMnu.exec( mevent->globalPos() );
}
int ChatDialog::loadInitMsg()
{
std::ostringstream out;
@ -145,11 +146,6 @@ void ChatDialog::insertChat()
}
n = 1 + n / 2; /* shrink it! */
//std::cerr << "Space count : " << n << std::endl;
std::string spaces(" ");
/* add in lines at the bottom */
int ts = time(NULL);
for(it = newchat.begin(); it != newchat.end(); it++)
@ -164,6 +160,7 @@ void ChatDialog::insertChat()
std::ostringstream out;
QString currenttxt = msgWidget->toHtml();
QString extraTxt;
if ((it->name == lastChatName) && (ts - lastChatTime < 60))
{
@ -173,48 +170,39 @@ void ChatDialog::insertChat()
{
#if defined(Q_OS_WIN)
/* nothing */
//out << "<br>" << std::endl;
#else
out << "<br>" << std::endl;
extraTxt += "<br>\n";
#endif
for(int i = 0; i < n; i++)
{
out << spaces;
extraTxt += " ";
}
QString timestamp = "[" + QDateTime::currentDateTime().toString("hh:mm:ss") + "]";
QString name = QString::fromStdString(it->name);
//QString line = "<span style=\"color:#1D84C9\">" + timestamp +
// " " + name + "</span> \n<br>";
QString line = "<span style=\"color:#1D84C9\"><strong>" + timestamp +
" " + name + "</strong></span> \n<br>";
out << line.toStdString();
extraTxt += line;
}
out << it -> msg;
extraTxt += QString::fromStdWString(it->msg);
/* This might be WIN32 only - or maybe Qt4.2.2 only - but need it for windows at the mom */
#if defined(Q_OS_WIN)
//out << "<br>";
//out << "<br>" << std::endl;
out << std::endl;
extraTxt += "\n";
#else
out << std::endl;
extraTxt += "\n";
#endif
lastChatName = it -> name;
lastChatTime = ts;
/* add it everytime */
QString extra = QString::fromStdString(out.str());
currenttxt += extra;
currenttxt += extraTxt;
msgWidget->setHtml(currenttxt);
//std::cerr << " Added Text: " << std::endl;
//std::cerr << out.str() << std::endl;
QScrollBar *qsb = msgWidget->verticalScrollBar();
qsb -> setValue(qsb->maximum());
}
@ -233,7 +221,7 @@ void ChatDialog::sendMsg()
//font.setItalic(ui.textitalicChatButton->isChecked());
ChatInfo ci;
ci.msg = lineWidget->text().toStdString();
ci.msg = lineWidget->text().toStdWString();
ci.chatflags = RS_CHAT_PUBLIC;
//ci.messageFont = font;
//ci.messageColor = textColor;
@ -280,8 +268,8 @@ void ChatDialog::insertSendList()
/* (0) Person */
item -> setText(0, QString::fromStdString(details.name));
//item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
item -> setFlags(Qt::ItemIsUserCheckable);
item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
//item -> setFlags(Qt::ItemIsUserCheckable);
item -> setCheckState(0, Qt::Checked);
/**** NOT SELECTABLE AT THE MOMENT

View File

@ -59,10 +59,12 @@ MessagesDialog::MessagesDialog(QWidget *parent)
connect( ui.msgWidget, SIGNAL( itemClicked ( QTreeWidgetItem *, int) ), this, SLOT( updateMessages ( QTreeWidgetItem *, int) ) );
connect( ui.listWidget, SIGNAL( currentRowChanged ( int) ), this, SLOT( changeBox ( int) ) );
connect(ui.newmessageButton, SIGNAL(clicked()), this, SLOT(newmessage()));
connect(ui.removemessageButton, SIGNAL(clicked()), this, SLOT(removemessage()));
connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview()));
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended()));
mCurrCertId = "";
mCurrMsgId = "";
@ -86,8 +88,8 @@ MessagesDialog::MessagesDialog(QWidget *parent)
msglheader->resizeSection ( 0, 125 );
msglheader->resizeSection ( 1, 100 );
msglheader->resizeSection ( 2, 100 );
msglheader->resizeSection ( 3, 200 );
msglheader->resizeSection ( 2, 250 );
msglheader->resizeSection ( 3, 50 );
/* Hide platform specific features */
@ -161,6 +163,64 @@ void MessagesDialog::replytomessage()
}
void MessagesDialog::togglefileview()
{
/* if msg header visible -> hide by changing splitter
* three widgets...
*/
QList<int> sizeList = ui.msgSplitter->sizes();
QList<int>::iterator it;
int listSize = 0;
int msgSize = 0;
int recommendSize = 0;
int i = 0;
for(it = sizeList.begin(); it != sizeList.end(); it++, i++)
{
if (i == 0)
{
listSize = (*it);
}
else if (i == 1)
{
msgSize = (*it);
}
else if (i == 2)
{
recommendSize = (*it);
}
}
int totalSize = listSize + msgSize + recommendSize;
bool toShrink = true;
if (recommendSize < (int) totalSize / 10)
{
toShrink = false;
}
QList<int> newSizeList;
if (toShrink)
{
newSizeList.push_back(listSize + recommendSize / 3);
newSizeList.push_back(msgSize + recommendSize * 2 / 3);
newSizeList.push_back(0);
}
else
{
/* no change */
int nlistSize = (totalSize * 2 / 3) * listSize / (listSize + msgSize);
int nMsgSize = (totalSize * 2 / 3) - listSize;
newSizeList.push_back(nlistSize);
newSizeList.push_back(nMsgSize);
newSizeList.push_back(totalSize * 1 / 3);
}
ui.msgSplitter->setSizes(newSizeList);
}
/* download the recommendations... */
void MessagesDialog::getcurrentrecommended()
@ -318,7 +378,8 @@ void MessagesDialog::insertMessages()
item -> setText(1, QString::fromStdString(out.str()));
}
item -> setText(2, QString::fromStdString(it->title));
// Subject
item -> setText(2, QString::fromStdWString(it->title));
// No of Files.
{
@ -327,48 +388,12 @@ void MessagesDialog::insertMessages()
item -> setText(3, QString::fromStdString(out.str()));
}
// Size.
// Msg.
// Rank
{
std::ostringstream out;
out << it -> size;
item -> setText(4, QString::fromStdString(out.str()));
}
/* strip out the \n and \r symbols */
std::string tmsg = it -> msg;
for(int i = 0; i < tmsg.length(); i++)
{
if ((tmsg[i] == '\n') ||
(tmsg[i] == '\r'))
{
tmsg[i] = ' ';
}
}
item -> setText(5, QString::fromStdString(tmsg));
{
std::ostringstream out;
out << "5"; // RANK
item -> setText(6, QString::fromStdString(out.str()));
}
{
std::ostringstream out;
out << it -> id;
item -> setText(7, QString::fromStdString(out.str()));
}
{
std::ostringstream out;
out << it -> msgId;
item -> setText(8, QString::fromStdString(out.str()));
if ((oldSelected) && (mid == out.str()))
item -> setText(4, QString::fromStdString(it->id));
item -> setText(5, QString::fromStdString(it->msgId));
if ((oldSelected) && (mid == it->msgId))
{
newSelected = item;
}
}
if (it -> msgflags & RS_MSG_NEW)
{
@ -421,14 +446,21 @@ void MessagesDialog::insertMsgTxtAndFiles()
if (!qtwi)
{
/* blank it */
ui.dateText-> setText("");
ui.toText->setText("");
ui.fromText->setText("");
ui.filesText->setText("");
ui.subjectText->setText("");
ui.msgText->setText("");
ui.msgList->clear();
return;
}
else
{
cid = qtwi -> text(7).toStdString();
mid = qtwi -> text(8).toStdString();
cid = qtwi -> text(4).toStdString();
mid = qtwi -> text(5).toStdString();
}
/* Save the Data.... for later */
@ -489,43 +521,55 @@ void MessagesDialog::insertMsgTxtAndFiles()
/* add the items in! */
tree->insertTopLevelItems(0, items);
/* add the Msg */
std::ostringstream msgout;
std::list<PersonInfo>::const_iterator pit;
msgout << "Msg Header ----------------- TS: " << mi->ts;
if (mi->msgto.size() > 0)
msgout << std::endl << "To: ";
QString msgTxt;
for(pit = mi->msgto.begin(); pit != mi->msgto.end(); pit++)
{
msgout << pit->name << " (" << pit->id << "), ";
msgTxt += QString::fromStdString(pit->name);
msgTxt += " <";
msgTxt += QString::fromStdString(pit->id);
msgTxt += ">, ";
}
if (mi->msgcc.size() > 0)
msgout << std::endl << "Cc: ";
msgTxt += "\nCc: ";
for(pit = mi->msgcc.begin(); pit != mi->msgcc.end(); pit++)
{
msgout << pit->name << " (" << pit->id << "), ";
msgTxt += QString::fromStdString(pit->name);
msgTxt += " <";
msgTxt += QString::fromStdString(pit->id);
msgTxt += ">, ";
}
if (mi->msgbcc.size() > 0)
msgout << std::endl << "Bcc: ";
msgTxt += "\nBcc: ";
for(pit = mi->msgbcc.begin(); pit != mi->msgbcc.end(); pit++)
{
msgout << pit->name << " (" << pit->id << "), ";
msgTxt += QString::fromStdString(pit->name);
msgTxt += " <";
msgTxt += QString::fromStdString(pit->id);
msgTxt += ">, ";
}
msgout << std::endl;
msgout << "----------------------------";
msgout << std::endl;
{
QDateTime qtime;
qtime.setTime_t(mi->ts);
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
ui.dateText-> setText(timestamp);
}
ui.toText->setText(msgTxt);
ui.fromText->setText(QString::fromStdString(mi->srcname));
msgout << "Subject: " << mi -> title << std::endl;
msgout << "Message: " << std::endl;
msgout << mi->msg << std::endl;
ui.msgText->setText(QString::fromStdString(msgout.str()));
ui.subjectText->setText(QString::fromStdWString(mi -> title));
ui.msgText->setText(QString::fromStdWString(mi->msg));
{
std::ostringstream out;
out << "(" << mi->count << " Files)";
ui.filesText->setText(QString::fromStdString(out.str()));
}
rsiface->unlockData(); /* Unlock Interface */
@ -545,8 +589,8 @@ bool MessagesDialog::getCurrentMsg(std::string &cid, std::string &mid)
QTreeWidgetItem *qtwi = msglist -> currentItem();
if (qtwi)
{
cid = qtwi -> text(7).toStdString();
mid = qtwi -> text(8).toStdString();
cid = qtwi -> text(4).toStdString();
mid = qtwi -> text(5).toStdString();
return true;
}
return false;

View File

@ -60,6 +60,9 @@ void updateMessages ( QTreeWidgetItem * item, int column );
void getcurrentrecommended();
void getallrecommended();
/* handle splitter */
void togglefileview();
private:
bool getCurrentMsg(std::string &cid, std::string &mid);

View File

@ -5,18 +5,22 @@
<rect>
<x>0</x>
<y>0</y>
<width>519</width>
<height>343</height>
<width>747</width>
<height>492</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>7</vsizetype>
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="palette" >
<palette>
<active>
@ -501,12 +505,105 @@
<enum>Qt::DefaultContextMenu</enum>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>4</number>
<item row="0" column="0" >
<widget class="QPushButton" name="newmessageButton" >
<property name="minimumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="spacing" >
<number>1</number>
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">New Message&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="styleSheet" >
<string>QPushButton
{
border-image: url(:/images/folder-draft24.png);
}
QPushButton:hover
{
border-image: url(:/images/folder-draft24-hover.png);
}
QPushButton:pressed
{
border-image: url(:/images/folder-draft24-pressed.png);
}
</string>
</property>
<property name="text" >
<string/>
</property>
<property name="iconSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="default" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="replymessageButton" >
<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>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">reply to selected message&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="styleSheet" >
<string>
QPushButton
{
border-image: url(:/images/replymail24.png);
}
QPushButton:hover
{
border-image: url(:/images/replymail24-hover.png);
}
QPushButton:pressed
{
border-image: url(:/images/replymail-pressed.png);
}
</string>
</property>
<property name="text" >
<string/>
</property>
<property name="iconSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="removemessageButton" >
<property name="minimumSize" >
@ -554,15 +651,28 @@ border-image: url(:/images/deletemail-pressed.png);
</property>
</widget>
</item>
<item row="0" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="4" >
<widget class="QSplitter" name="splitter_3" >
<widget class="QSplitter" name="splitter_2" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<widget class="QListWidget" name="listWidget" >
<property name="maximumSize" >
<size>
<width>160</width>
<width>120</width>
<height>16777215</height>
</size>
</property>
@ -626,15 +736,17 @@ border-image: url(:/images/deletemail-pressed.png);
</property>
</item>
</widget>
<widget class="QSplitter" name="splitter_2" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<widget class="QSplitter" name="splitter" >
<widget class="QSplitter" name="msgSplitter" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<widget class="QTreeWidget" name="msgWidget" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>5</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::CustomContextMenu</enum>
</property>
@ -645,7 +757,7 @@ border-image: url(:/images/deletemail-pressed.png);
<bool>true</bool>
</property>
<property name="columnCount" >
<number>6</number>
<number>4</number>
</property>
<column>
<property name="text" >
@ -659,36 +771,377 @@ border-image: url(:/images/deletemail-pressed.png);
</column>
<column>
<property name="text" >
<string>Title</string>
<string>Subject</string>
</property>
</column>
<column>
<property name="text" >
<string>Count</string>
</property>
</column>
<column>
<property name="text" >
<string>Size</string>
</property>
</column>
<column>
<property name="text" >
<string>Msg</string>
<string>#Recommendations</string>
</property>
</column>
</widget>
<widget class="QTextBrowser" name="msgText" />
</widget>
<widget class="QWidget" name="layoutWidget" >
<widget class="QWidget" name="" >
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<layout class="QVBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" >
<property name="margin" >
<item row="0" column="0" >
<widget class="QLabel" name="label_16" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>60</width>
<height>10</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="font" >
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Subject:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="subjectText" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_7" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>60</width>
<height>10</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="font" >
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>From:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLabel" name="fromText" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_12" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>60</width>
<height>10</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="font" >
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Date:</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLabel" name="dateText" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_14" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>60</width>
<height>10</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="font" >
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>To:</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QLabel" name="toText" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QTextBrowser" name="msgText" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>10</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="spacing" >
<property name="topMargin" >
<number>0</number>
</property>
<item row="1" column="0" colspan="2" >
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/attachment.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:10pt; font-weight:600;">Recommended Files&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QLabel" name="filesText" >
<property name="font" >
<font>
<pointsize>10</pointsize>
<italic>true</italic>
</font>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QPushButton" name="expandFilesButton" >
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add_24x24.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>351</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="downloadButton" >
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/down.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QTreeWidget" name="msgList" >
<property name="contextMenuPolicy" >
<enum>Qt::CustomContextMenu</enum>
@ -717,166 +1170,8 @@ border-image: url(:/images/deletemail-pressed.png);
</property>
</column>
</widget>
</item>
<item row="0" column="0" >
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/attachment.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:10pt; font-weight:600;">Recommended Files&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="replymessageButton" >
<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>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">reply to selected message&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="styleSheet" >
<string>
QPushButton
{
border-image: url(:/images/replymail24.png);
}
QPushButton:hover
{
border-image: url(:/images/replymail24-hover.png);
}
QPushButton:pressed
{
border-image: url(:/images/replymail-pressed.png);
}
</string>
</property>
<property name="text" >
<string/>
</property>
<property name="iconSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QPushButton" name="newmessageButton" >
<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>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">New Message&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="styleSheet" >
<string>QPushButton
{
border-image: url(:/images/folder-draft24.png);
}
QPushButton:hover
{
border-image: url(:/images/folder-draft24-hover.png);
}
QPushButton:pressed
{
border-image: url(:/images/folder-draft24-pressed.png);
}
</string>
</property>
<property name="text" >
<string/>
</property>
<property name="iconSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="default" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>

View File

@ -336,11 +336,24 @@ void PeersDialog::chatfriend()
if (!i)
return;
std::string status = (i -> text(1)).toStdString();
std::string name = (i -> text(2)).toStdString();
std::string id = (i -> text(10)).toStdString();
if (status != "Online")
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(id, detail))
{
return;
}
if (detail.state & RS_PEER_STATE_CONNECTED)
{
/* must reference ChatDialog */
if (chatDialog)
{
chatDialog->getPrivateChat(id, name, true);
}
}
else
{
/* info dialog */
QMessageBox::StandardButton sb = QMessageBox::question ( NULL,
@ -351,16 +364,11 @@ void PeersDialog::chatfriend()
{
msgfriend();
}
}
return;
}
/* must reference ChatDialog */
if (chatDialog)
{
chatDialog->getPrivateChat(id, name, true);
}
}
void PeersDialog::msgfriend()
{
std::cerr << "SharedFilesDialog::msgfriend()" << std::endl;

View File

@ -200,7 +200,7 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci)
/* add in lines at the bottom */
std::ostringstream out;
QString extraTxt;
int ts = time(NULL);
@ -222,7 +222,7 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci)
{
QString line = "<br>\n<span style=\"color:#1D84C9\"><strong> ----- PEER OFFLINE (Chat will be lost) -----</strong></span> \n<br>";
out << line.toStdString();
extraTxt += line;
}
@ -236,40 +236,35 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci)
#if defined(Q_OS_WIN)
// Nothing.
#else
out << "<br>" << std::endl;
extraTxt += "<br>\n";
#endif
for(int i = 0; i < n; i++)
{
out << spaces;
extraTxt += " ";
}
//out << "[ " << ci->name << " +" << ts - lastChatTime << "s ]" << std::endl;
//out << "<br>" << std::endl;
QString timestamp = "(" + QDateTime::currentDateTime().toString("hh:mm:ss") + ") ";
//QString pre = tr("Peer:" );
QString name = QString::fromStdString(ci->name);
QString line = "<span style=\"color:#1D84C9\"><strong>" + timestamp +
" " + name + "</strong></span> \n<br>";
out << line.toStdString();
extraTxt += line;
}
out << ci -> msg;
extraTxt += QString::fromStdWString(ci -> msg);
/* This might be WIN32 only - or maybe Qt4.2.2 only - but need it for windows at the mom */
#if defined(Q_OS_WIN)
//out << "<br>"; // << std::endl;
out << std::endl;
extraTxt += "\n";
#else
out << std::endl;
extraTxt += "\n";
#endif
lastChatTime = ts;
lastChatName = ci->name;
QString extra = QString::fromStdString(out.str());
currenttxt += extra;
currenttxt += extraTxt;
msgWidget->setHtml(currenttxt);
@ -296,7 +291,7 @@ void PopupChatDialog::sendChat()
rsiface->unlockData(); /* Unlock Interface */
}
ci.msg = lineWidget->text().toStdString();
ci.msg = lineWidget->text().toStdWString();
ci.chatflags = RS_CHAT_PRIVATE;
addChatMsg(&ci);

View File

@ -162,13 +162,13 @@ void ChanMsgDialog::insertSendList()
/* (0) Person */
item -> setText(0, QString::fromStdString(detail.name));
/* () Org */
item -> setText(1, QString::fromStdString(detail.org));
//item -> setText(1, QString::fromStdString(detail.org));
/* () Location */
item -> setText(2, QString::fromStdString(detail.location));
//item -> setText(2, QString::fromStdString(detail.location));
/* () Country */
item -> setText(3, QString::fromStdString(detail.email));
//item -> setText(3, QString::fromStdString(detail.email));
/* () Id */
item -> setText(4, QString::fromStdString(detail.id));
item -> setText(1, QString::fromStdString(detail.id));
item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
//item -> setCheckState(0, Qt::Checked);
@ -192,7 +192,7 @@ void ChanMsgDialog::insertSendList()
/* remove old items ??? */
sendWidget->clear();
sendWidget->setColumnCount(6);
sendWidget->setColumnCount(1);
/* add the items in! */
sendWidget->insertTopLevelItems(0, items);
@ -378,8 +378,8 @@ void ChanMsgDialog::sendMessage()
/* construct a message */
MessageInfo mi;
mi.title = ui.titleEdit->text().toStdString();
mi.msg = ui.msgText->toPlainText().toStdString();
mi.title = ui.titleEdit->text().toStdWString();
mi.msg = ui.msgText->toPlainText().toStdWString();
/* filled in later */
//mi.msgId = rand();
@ -451,7 +451,7 @@ void ChanMsgDialog::togglePersonItem( QTreeWidgetItem *item, int col )
std::cerr << "TogglePersonItem()" << std::endl;
/* extract id */
std::string id = (item -> text(4)).toStdString();
std::string id = (item -> text(1)).toStdString();
/* get state */
bool inMsg = (Qt::Checked == item -> checkState(0)); /* alway column 0 */

View File

@ -248,8 +248,12 @@ void NotifyQt::displayMessages()
for(it = msgs.begin(); it != msgs.end(); it++)
{
out << "Message: ";
out << it->title << std::endl;
out << "\t" << it->msg << std::endl;
std::string cnv_title(it->title.begin(), it->title.end());
out << cnv_title << std::endl;
std::string cnv_msg(it->msg.begin(), it->msg.end());
out << "\t" << cnv_msg << std::endl;
const std::list<FileInfo> &files = it -> files;
for(fit = files.begin(), i = 1; fit != files.end(); fit++, i++)
{

View File

@ -187,11 +187,11 @@ class MessageInfo: public BaseInfo
std::list<PersonInfo> msgcc;
std::list<PersonInfo> msgbcc;
std::string title;
std::string msg;
std::wstring title;
std::wstring msg;
std::string attach_title;
std::string attach_comment;
std::wstring attach_title;
std::wstring attach_comment;
std::list<FileInfo> files;
int size; /* total of files */
int count; /* file count */
@ -228,7 +228,7 @@ class ChatInfo: public BaseInfo
std::string rsid;
unsigned int chatflags;
std::string name;
std::string msg;
std::wstring msg;
};
/* matched to the uPnP states */