mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-18 04:14:28 -05:00
moved Horizontal text Splitter to Insert Menu and added Paragraph ComboBox instead of Lists ComboBox, Lists needs a own Format Menu not more use as ComboBox.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3000 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ff32924d73
commit
c9fe6dee6b
@ -69,7 +69,6 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
|
||||
connect(ui.sizedecreaseButton, SIGNAL (clicked()), this, SLOT (fontSizeDecrease()));
|
||||
connect(ui.actionQuote, SIGNAL(triggered()), this, SLOT(blockQuote()));
|
||||
connect(ui.codeButton, SIGNAL (clicked()), this, SLOT (toggleCode()));
|
||||
connect(ui.splitPostButton, SIGNAL (clicked()), this, SLOT (addPostSplitter()));
|
||||
|
||||
connect(ui.msgText, SIGNAL( checkSpellingChanged( bool ) ), this, SLOT( spellChecking( bool ) ) );
|
||||
|
||||
@ -135,14 +134,15 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
|
||||
actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
|
||||
actionAlignJustify->setCheckable(true);
|
||||
|
||||
ui.comboStyle->addItem("Standard");
|
||||
/*ui.comboStyle->addItem("Standard");
|
||||
ui.comboStyle->addItem("Bullet List (Disc)");
|
||||
ui.comboStyle->addItem("Bullet List (Circle)");
|
||||
ui.comboStyle->addItem("Bullet List (Square)");
|
||||
ui.comboStyle->addItem("Ordered List (Decimal)");
|
||||
ui.comboStyle->addItem("Ordered List (Alpha lower)");
|
||||
ui.comboStyle->addItem("Ordered List (Alpha upper)");
|
||||
connect(ui.comboStyle, SIGNAL(activated(int)),this, SLOT(textStyle(int)));
|
||||
ui.comboStyle->addItem("Ordered List (Alpha upper)");*/
|
||||
//connect(ui.comboStyle, SIGNAL(activated(int)),this, SLOT(textStyle(int)));
|
||||
connect(ui.comboStyle, SIGNAL(activated(int)),this, SLOT(changeFormatType(int)));
|
||||
|
||||
connect(ui.comboFont, SIGNAL(activated(const QString &)), this, SLOT(textFamily(const QString &)));
|
||||
|
||||
@ -680,6 +680,10 @@ void MessageComposer::setupInsertActions()
|
||||
a = new QAction(QIcon(""), tr("&Image"), this);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(addImage()));
|
||||
menu->addAction(a);
|
||||
|
||||
a = new QAction(QIcon(""), tr("&Horizontal Line"), this);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(addPostSplitter()));
|
||||
menu->addAction(a);
|
||||
|
||||
}
|
||||
|
||||
@ -721,6 +725,62 @@ void MessageComposer::textSize(const QString &p)
|
||||
}
|
||||
}
|
||||
|
||||
void MessageComposer::changeFormatType(int styleIndex )
|
||||
{
|
||||
ui.msgText->setFocus( Qt::OtherFocusReason );
|
||||
|
||||
QTextCursor cursor = ui.msgText->textCursor();
|
||||
//QTextBlockFormat bformat = cursor.blockFormat();
|
||||
QTextBlockFormat bformat;
|
||||
QTextCharFormat cformat;
|
||||
|
||||
switch (styleIndex) {
|
||||
default:
|
||||
case 0:
|
||||
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 0 ) );
|
||||
cformat.setFontWeight( QFont::Normal );
|
||||
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) );
|
||||
break;
|
||||
case 1:
|
||||
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 1 ) );
|
||||
cformat.setFontWeight( QFont::Bold );
|
||||
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 3 ) );
|
||||
break;
|
||||
case 2:
|
||||
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 2 ) );
|
||||
cformat.setFontWeight( QFont::Bold );
|
||||
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 2 ) );
|
||||
break;
|
||||
case 3:
|
||||
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 3 ) );
|
||||
cformat.setFontWeight( QFont::Bold );
|
||||
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 1 ) );
|
||||
break;
|
||||
case 4:
|
||||
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 4 ) );
|
||||
cformat.setFontWeight( QFont::Bold );
|
||||
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) );
|
||||
break;
|
||||
case 5:
|
||||
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 5 ) );
|
||||
cformat.setFontWeight( QFont::Bold );
|
||||
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( -1 ) );
|
||||
break;
|
||||
case 6:
|
||||
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 6 ) );
|
||||
cformat.setFontWeight( QFont::Bold );
|
||||
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( -2 ) );
|
||||
break;
|
||||
}
|
||||
//cformat.clearProperty( TextFormat::HasCodeStyle );
|
||||
|
||||
cursor.beginEditBlock();
|
||||
cursor.mergeBlockFormat( bformat );
|
||||
cursor.select( QTextCursor::BlockUnderCursor );
|
||||
cursor.mergeCharFormat( cformat );
|
||||
cursor.endEditBlock();
|
||||
}
|
||||
|
||||
void MessageComposer::textStyle(int styleIndex)
|
||||
{
|
||||
QTextCursor cursor = ui.msgText->textCursor();
|
||||
|
@ -67,6 +67,9 @@ public slots:
|
||||
void sendMessage();
|
||||
void cancelMessage();
|
||||
void addImage();
|
||||
|
||||
void changeFormatType(int styleIndex );
|
||||
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent * event);
|
||||
|
@ -182,10 +182,50 @@ border: 1px solid #CCCCCC;}</string>
|
||||
<widget class="QComboBox" name="comboStyle">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Paragraph</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Heading 1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Heading 2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Heading 2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Heading 3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Heading 4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Heading 5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Heading 6</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
@ -383,7 +423,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="10">
|
||||
<item row="0" column="9">
|
||||
<widget class="QToolButton" name="colorbtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -408,7 +448,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="11">
|
||||
<item row="0" column="10">
|
||||
<widget class="QToolButton" name="textalignmentbtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -442,7 +482,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="12">
|
||||
<item row="0" column="11">
|
||||
<widget class="QToolButton" name="imagebtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -500,7 +540,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="15">
|
||||
<item row="0" column="14">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -513,29 +553,6 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<widget class="QToolButton" name="splitPostButton">
|
||||
<property name="toolTip">
|
||||
<string>Split text</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/textedit/hi22-action-insert-more-mark.png</normaloff>:/images/textedit/hi22-action-insert-more-mark.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
Loading…
Reference in New Issue
Block a user