design improvements for AddLinksDialog

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2172 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-02-02 00:01:17 +00:00
parent 1e96a13c5d
commit 4e6290d985
3 changed files with 304 additions and 205 deletions

View file

@ -44,12 +44,15 @@ AddLinksDialog::AddLinksDialog(QString url, QWidget *parent)
connect(ui.addLinkButton, SIGNAL(clicked()), this, SLOT(addLinkComment())); connect(ui.addLinkButton, SIGNAL(clicked()), this, SLOT(addLinkComment()));
connect(ui.closepushButton, SIGNAL(clicked()), this, SLOT(close())); connect(ui.closepushButton, SIGNAL(clicked()), this, SLOT(close()));
connect( ui.anonBox, SIGNAL( stateChanged ( int ) ), this, SLOT( load ( void ) ) );
ui.linkLineEdit->setReadOnly(true); ui.linkLineEdit->setReadOnly(true);
ui.linkLineEdit->setText(url); ui.linkLineEdit->setText(url);
RetroShareLinkAnalyzer analyzer(url); RetroShareLinkAnalyzer analyzer(url);
QVector<RetroShareLinkData> linkList; QVector<RetroShareLinkData> linkList;
analyzer.getFileInformation(linkList); analyzer.getFileInformation(linkList);
if (!linkList.isEmpty()) if (!linkList.isEmpty())
{ /* set title as first name from list */ { /* set title as first name from list */
RetroShareLinkData item = linkList.first(); RetroShareLinkData item = linkList.first();
@ -60,6 +63,8 @@ AddLinksDialog::AddLinksDialog(QString url, QWidget *parent)
ui.titleLineEdit->setText("New File"); ui.titleLineEdit->setText("New File");
} }
load();
/* Hide platform specific features */ /* Hide platform specific features */
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
@ -106,3 +111,23 @@ void AddLinksDialog::addLinkComment()
close(); close();
} }
void AddLinksDialog::load()
{
if (ui.anonBox->isChecked())
{
/* disable comment + score */
ui.scoreBox->setEnabled(false);
ui.linkTextEdit->setEnabled(false);
/* done! */
return;
}
else
{
/* enable comment + score */
ui.scoreBox->setEnabled(true);
ui.linkTextEdit->setEnabled(true);
}
}

View file

@ -38,6 +38,8 @@ public:
public slots: public slots:
void addLinkComment(); void addLinkComment();
void load();
private: private:
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::AddLinksDialog ui; Ui::AddLinksDialog ui;

View file

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>568</width> <width>614</width>
<height>429</height> <height>429</height>
</rect> </rect>
</property> </property>
@ -18,7 +18,32 @@
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset> <normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0" colspan="4">
<widget class="QFrame" name="frame">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>52</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QFrame#frame{background-image: url(:/images/connect/connectFriendBanner.png);}
</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="linksiconlabel"> <widget class="QLabel" name="linksiconlabel">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@ -30,117 +55,194 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="images.qrc">:/images/ktorrent32.png</pixmap> <pixmap resource="images.qrc">:/images/irkick.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" colspan="3"> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:18pt; font-weight:600; color:#00aa00;&quot;&gt;Add Link to Cloud&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'DejaVu Sans'; font-size:18pt; font-weight:600; color:#ffffff;&quot;&gt;Add Link to Cloud&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="4"> <item row="1" column="0" colspan="4">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="1" column="1">
<widget class="QPushButton" name="closepushButton">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="addLinkButton">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Add Link</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>375</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
<string>Add a new Link</string> <string>Add a new Link</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="4"> <property name="spacing">
<layout class="QHBoxLayout"> <number>1</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>10</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Title:</string> <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:600; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:400;&quot;&gt;Title:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="titleLineEdit"> <widget class="QLabel" name="label_7">
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font> </font>
</property> </property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:600; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:400;&quot;&gt;Url:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0" colspan="4">
<layout class="QHBoxLayout">
<item> <item>
<widget class="QLabel" name="label_7"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLineEdit" name="titleLineEdit">
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font> </font>
</property> </property>
<property name="text">
<string>Url:</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="linkLineEdit"> <widget class="QLineEdit" name="linkLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>10</pointsize>
</font> </font>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="0" colspan="4"> </layout>
<widget class="QTextEdit" name="linkTextEdit"> </item>
<property name="sizePolicy"> <item row="1" column="0">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <widget class="QFrame" name="frame_3">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>16777215</height> <height>40</height>
</size> </size>
</property> </property>
<property name="font"> <property name="styleSheet">
<font> <string notr="true">QFrame#frame_3{
<pointsize>12</pointsize> background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
</font> stop:0 #FEFEFE, stop:1 #E8E8E8);
border: 1px solid #CCCCCC;}</string>
</property> </property>
</widget> <property name="frameShape">
</item> <enum>QFrame::StyledPanel</enum>
<item row="3" column="0"> </property>
<widget class="QLabel" name="label_8"> <property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="anonBox">
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>10</pointsize>
<weight>75</weight> <weight>50</weight>
<bold>true</bold> <bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Score:</string> <string>Add Anonymous Link</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item>
<widget class="QComboBox" name="scoreBox"> <widget class="QComboBox" name="scoreBox">
<item> <item>
<property name="text"> <property name="text">
@ -189,29 +291,15 @@ p, li { white-space: pre-wrap; }
</item> </item>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item>
<widget class="QCheckBox" name="anonBox">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Add Anonymous Link</string>
</property>
</widget>
</item>
<item row="3" column="3">
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>196</width> <width>299</width>
<height>23</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -219,47 +307,31 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="2" column="0">
<spacer name="horizontalSpacer"> <widget class="QTextEdit" name="linkTextEdit">
<property name="orientation"> <property name="sizePolicy">
<enum>Qt::Horizontal</enum> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="maximumSize">
<size> <size>
<width>375</width> <width>16777215</width>
<height>20</height> <height>16777215</height>
</size> </size>
</property> </property>
</spacer>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="closepushButton">
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="text">
<string>Cancel</string>
</property>
</widget> </widget>
</item> </item>
<item row="2" column="3"> </layout>
<widget class="QPushButton" name="addLinkButton"> </widget>
<property name="font"> </item>
<font> </layout>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Add Link</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>