fixed resize size of MessagesDialog

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@403 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-03-23 01:13:09 +00:00
parent 7c10e395b6
commit 351559becd
8 changed files with 118 additions and 86 deletions

View File

@ -78,7 +78,8 @@ MessagesDialog::MessagesDialog(QWidget *parent)
QHeaderView * msgwheader = ui.msgWidget->header () ;
msgwheader->setResizeMode (0, QHeaderView::Interactive);
msgwheader->resizeSection ( 0, 125 );
msgwheader->resizeSection ( 0, 140 );
msgwheader->resizeSection ( 2, 150 );
/* Set header resize modes and initial section sizes */
QHeaderView * msglheader = ui.msgList->header () ;
@ -87,10 +88,10 @@ MessagesDialog::MessagesDialog(QWidget *parent)
msglheader->setResizeMode (2, QHeaderView::Interactive);
msglheader->setResizeMode (3, QHeaderView::Interactive);
msglheader->resizeSection ( 0, 125 );
msglheader->resizeSection ( 0, 200 );
msglheader->resizeSection ( 1, 100 );
msglheader->resizeSection ( 2, 250 );
msglheader->resizeSection ( 3, 50 );
msglheader->resizeSection ( 2, 100 );
msglheader->resizeSection ( 3, 200 );
/* Hide platform specific features */

View File

@ -780,7 +780,7 @@ border-image: url(:/images/deletemail-pressed.png);
</property>
</column>
</widget>
<widget class="QWidget" name="" >
<widget class="QWidget" name="layoutWidget" >
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
@ -1130,6 +1130,12 @@ p, li { white-space: pre-wrap; }
</item>
<item>
<widget class="QPushButton" name="downloadButton" >
<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;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Download all Recommended Files&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="text" >
<string/>
</property>

View File

@ -58,12 +58,16 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
connect(ui.sendButton, SIGNAL(clicked( ) ), this, SLOT(sendChat( ) ));
connect(ui.colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
connect(ui.fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
connect(ui.textboldButton, SIGNAL(triggered()), this, SLOT(insertBold()));
connect(ui.textunderlineButton, SIGNAL(triggered()), this, SLOT(insertUnderline()));
connect(ui.textitalicButton, SIGNAL(triggered()), this, SLOT(insertItalic()));
connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(textBold()));
connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(textUnderline()));
connect(ui.textitalicButton, SIGNAL(clicked()), this, SLOT(textItalic()));
//connect(ui.actionBold, SIGNAL(triggered()), this, SLOT(insertBold()));
//connect(ui.actionItalic, SIGNAL(triggered()), this, SLOT(insertItalic()));
//connect(ui.actionStrike, SIGNAL(triggered()), this, SLOT(insertStrike()));
//connect(ui.actionUnderline, SIGNAL(triggered()), this, SLOT(insertUnderline()));
// Create the status bar
std::ostringstream statusstr;
@ -80,7 +84,12 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
setWindowIcon(QIcon(QString(":/images/rstray3.png")));
ui.textboldButton->setIcon(QIcon(QString(":/images/edit-bold.png")));
ui.textunderlineButton->setIcon(QIcon(QString(":/images/edit-underline.png")));
ui.textitalicButton->setIcon(QIcon(QString(":/images/edit-italic.png")));
ui.textitalicButton->setIcon(QIcon(QString(":/images/edit-italic.png")));
ui.fontButton->setIcon(QIcon(QString(":/images/fonts.png")));
//QMenu * fontmenu = new QMenu();
//fontmenu->addAction(actionBold);
//ui.fontButton->setMenu(fontmenu);
}
@ -121,57 +130,20 @@ void PopupChatDialog::setColor()
ui.colorButton->setPalette(QPalette(col));
QTextCharFormat fmt;
fmt.setForeground(col);
mergeFormatOnWordOrSelection(fmt);
colorChanged(col);
}
}
void PopupChatDialog::textBold()
void PopupChatDialog::setFont()
{
QTextCharFormat fmt;
fmt.setFontWeight(ui.textboldButton->isChecked() ? QFont::Bold : QFont::Normal);
mergeFormatOnWordOrSelection(fmt);
bool ok;
QFont font = QFontDialog::getFont(&ok, QFont(ui.lineEdit->text()), this);
if (ok) {
//ui.lineEdit->setText(font.key());
ui.lineEdit->setFont(font);
}
}
void PopupChatDialog::textUnderline()
{
QTextCharFormat fmt;
fmt.setFontUnderline(ui.textunderlineButton->isChecked());
mergeFormatOnWordOrSelection(fmt);
}
void PopupChatDialog::textItalic()
{
QTextCharFormat fmt;
fmt.setFontItalic(ui.textitalicButton->isChecked());
mergeFormatOnWordOrSelection(fmt);
}
void PopupChatDialog::currentCharFormatChanged(const QTextCharFormat &format)
{
fontChanged(format.font());
colorChanged(format.foreground().color());
}
void PopupChatDialog::mergeFormatOnWordOrSelection(const QTextCharFormat &format)
{
QTextCursor cursor = ui.textBrowser->textCursor();
if (!cursor.hasSelection())
cursor.select(QTextCursor::WordUnderCursor);
cursor.mergeCharFormat(format);
ui.textBrowser->mergeCurrentCharFormat(format);
}
void PopupChatDialog::fontChanged(const QFont &f)
{
//comboFont->setCurrentIndex(comboFont->findText(QFontInfo(f).family()));
//comboSize->setCurrentIndex(comboSize->findText(QString::number(f.pointSize())));
ui.textboldButton->setChecked(f.bold());
ui.textunderlineButton->setChecked(f.italic());
ui.textitalicButton->setChecked(f.underline());
}
void PopupChatDialog::colorChanged(const QColor &c)
{
@ -190,7 +162,6 @@ void PopupChatDialog::updateChat()
}
void PopupChatDialog::addChatMsg(ChatInfo *ci)
{
QTextBrowser *msgWidget = ui.textBrowser;
@ -294,3 +265,46 @@ void PopupChatDialog::showAvatarFrame(bool show)
ui.avatarFrameButton->setIcon(QIcon(tr(":images/show_toolbox_frame.png")));
}
}
void PopupChatDialog::insertBold()
{
this->insertAutour(tr("<b>"), tr("</b>"));
this->ui.lineEdit->setFocus();
}
void PopupChatDialog::insertItalic()
{
this->insertAutour(tr("<i>"), tr("</i>"));
this->ui.lineEdit->setFocus();
}
void PopupChatDialog::insertUnderline()
{
this->insertAutour(tr("<u>"), tr("</u>"));
this->ui.lineEdit->setFocus();
}
void PopupChatDialog::insertStrike()
{
this->insertAutour(tr("<s>"), tr("</s>"));
this->ui.lineEdit->setFocus();
}
void PopupChatDialog::insertAutour(QString leftTruc,QString rightTruc)
{
int p0 = ui.lineEdit->cursorPosition();
QString stringToInsert = leftTruc ;
stringToInsert.append(rightTruc);
ui.lineEdit->insert(stringToInsert);
ui.lineEdit->setCursorPosition(p0 + leftTruc.size());
}

View File

@ -49,6 +49,12 @@ public:
void updateChat();
void addChatMsg(ChatInfo *ci);
void insertBold();
void insertItalic();
void insertUnderline();
void insertStrike();
void insertAutour(QString leftTruc,QString rightTruc);
public slots:
/** Overloaded QWidget.show */
@ -61,23 +67,13 @@ private slots:
void showAvatarFrame(bool show);
void setColor();
void textBold();
void textUnderline();
void textItalic();
void sendChat();
void setColor();
void setFont();
void currentCharFormatChanged(const QTextCharFormat &format);
void sendChat();
private:
void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
void fontChanged(const QFont &f);
void colorChanged(const QColor &c);

View File

@ -82,18 +82,6 @@
<string/>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>8</number>
</property>
<property name="rightMargin" >
<number>6</number>
</property>
<property name="bottomMargin" >
<number>8</number>
</property>
<item row="0" column="0" >
<spacer>
<property name="orientation" >
@ -101,8 +89,8 @@
</property>
<property name="sizeHint" >
<size>
<width>261</width>
<height>20</height>
<width>291</width>
<height>24</height>
</size>
</property>
</spacer>
@ -128,7 +116,7 @@
<iconset>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
</property>
<property name="checkable" >
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
@ -153,7 +141,7 @@
<iconset>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
</property>
<property name="checkable" >
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
@ -178,11 +166,36 @@
<iconset>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
</property>
<property name="checkable" >
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="4" >
<widget class="QPushButton" name="fontButton" >
<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="text" >
<string/>
</property>
<property name="icon" >
<iconset>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="5" >
<widget class="QPushButton" name="colorButton" >
<property name="minimumSize" >
<size>

View File

@ -4,6 +4,7 @@
<file>help/licence.html</file>
<file>help/thanks.html</file>
<file>images/addfriendlabel.png</file>
<file>images/backgroundl.png</file>
<file>images/blockdevice.png</file>
<file>images/channels.png</file>
<file>images/channeldelete.png</file>
@ -16,6 +17,7 @@
<file>images/FileTypePicture.png</file>
<file>images/FileTypeProgram.png</file>
<file>images/FileTypeVideo.png</file>
<file>images/fonts.png</file>
<file>images/RetroShare16.png</file>
<file>images/add-friend24.png</file>
<file>images/add-share24.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B