mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-23 14:39:34 -05:00
changes for LinksDialog: disabled bold text, added a Label to display each Link in html format
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2197 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d490f6b0fe
commit
7941ef591e
@ -90,27 +90,26 @@ LinksDialog::LinksDialog(QWidget *parent)
|
||||
|
||||
connect( ui.anonBox, SIGNAL( stateChanged ( int ) ), this, SLOT( checkAnon ( void ) ) );
|
||||
|
||||
connect( ui.linklabel, SIGNAL(anchorClicked(const QUrl &)), SLOT(anchorClicked(const QUrl &)));
|
||||
|
||||
|
||||
mStart = 0;
|
||||
|
||||
|
||||
/* hide the Tree +/- */
|
||||
// ui.linkTreeWidget -> setRootIsDecorated( false );
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * _header = ui.linkTreeWidget->header () ;
|
||||
// _header->setResizeMode (0, QHeaderView::Custom);
|
||||
_header->setResizeMode (0, QHeaderView::Interactive);
|
||||
_header->setResizeMode (1, QHeaderView::Interactive);
|
||||
_header->setResizeMode (2, QHeaderView::Interactive);
|
||||
|
||||
_header->resizeSection ( 0, 400 );
|
||||
_header->resizeSection ( 1, 50 );
|
||||
_header->resizeSection ( 1, 60 );
|
||||
_header->resizeSection ( 2, 150 );
|
||||
|
||||
ui.linkTreeWidget->setSortingEnabled(true);
|
||||
|
||||
ui.linklabel->setMinimumWidth(20);
|
||||
|
||||
|
||||
/* Set a GUI update timer - much cleaner than
|
||||
* doing everything through the notify agent
|
||||
@ -366,10 +365,10 @@ void LinksDialog::updateLinks()
|
||||
{
|
||||
item -> setText(0, QString::fromStdWString(detail.title));
|
||||
/* Bold and bigger */
|
||||
QFont font = item->font(0);
|
||||
/*QFont font = item->font(0);
|
||||
font.setBold(true);
|
||||
font.setPointSize(font.pointSize() + 2);
|
||||
item->setFont(0, font);
|
||||
item->setFont(0, font);*/
|
||||
}
|
||||
|
||||
/* (1) Rank */
|
||||
@ -378,22 +377,31 @@ void LinksDialog::updateLinks()
|
||||
out << 100 * (detail.rank / (maxRank + 0.01));
|
||||
item -> setText(1, QString::fromStdString(out.str()));
|
||||
/* Bold and bigger */
|
||||
QFont font = item->font(1);
|
||||
//font.setBold(true);
|
||||
/*QFont font = item->font(1);
|
||||
font.setBold(true);
|
||||
font.setPointSize(font.pointSize() + 2);
|
||||
item->setFont(1, font);
|
||||
item->setFont(1, font);*/
|
||||
}
|
||||
|
||||
/* (2) Link */
|
||||
{
|
||||
item -> setText(2, QString::fromStdWString(detail.link));
|
||||
/* Bold and bigger */
|
||||
QFont font = item->font(2);
|
||||
/*QFont font = item->font(2);
|
||||
font.setBold(true);
|
||||
font.setPointSize(font.pointSize() + 2);
|
||||
item->setFont(2, font);
|
||||
item->setFont(2, font);*/
|
||||
}
|
||||
|
||||
/* (3) Date */
|
||||
/*{
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(it->lastPost);
|
||||
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
||||
item -> setText(3, timestamp);
|
||||
}*/
|
||||
|
||||
|
||||
/* (4) rid */
|
||||
item -> setText(4, QString::fromStdString(detail.rid));
|
||||
|
||||
@ -654,6 +662,8 @@ void LinksDialog::updateComments(std::string rid, std::string pid)
|
||||
/* set Link details */
|
||||
ui.titleLineEdit->setText(QString::fromStdWString(detail.title));
|
||||
ui.linkLineEdit->setText(QString::fromStdWString(detail.link));
|
||||
ui.linklabel->setHtml("<a href='" + QString::fromStdWString(detail.link) + "'> " + QString::fromStdWString(detail.link) +"</a>");
|
||||
|
||||
|
||||
if (mLinkId == rid)
|
||||
{
|
||||
@ -998,3 +1008,60 @@ void LinksDialog::downloadSelected()
|
||||
rsFiles->FileRequest(item.getName().toStdString(), item.getHash().toStdString(), item.getSize().toULong(), "", 0, srcIds);
|
||||
}
|
||||
}
|
||||
|
||||
void LinksDialog::anchorClicked (const QUrl& link )
|
||||
{
|
||||
#ifdef LINK_DEBUG
|
||||
std::cerr << "LinksDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
|
||||
#endif
|
||||
|
||||
if (link.scheme() == "retroshare")
|
||||
{
|
||||
QStringList L = link.toString().split("|") ;
|
||||
|
||||
std::string fileName = L.at(1).toStdString() ;
|
||||
uint64_t fileSize = L.at(2).toULongLong();
|
||||
std::string fileHash = L.at(3).toStdString() ;
|
||||
|
||||
#ifdef LINK_DEBUG
|
||||
std::cerr << "LinksDialog::anchorClicked FileRequest : fileName : " << fileName << ". fileHash : " << fileHash << ". fileSize : " << fileSize << std::endl;
|
||||
#endif
|
||||
|
||||
if (fileName != "" && fileHash != "")
|
||||
{
|
||||
std::list<std::string> srcIds;
|
||||
|
||||
if(rsFiles->FileRequest(fileName, fileHash, fileSize, "", RS_FILE_HINTS_NETWORK_WIDE, srcIds))
|
||||
{
|
||||
QMessageBox mb(tr("File Request Confirmation"), tr("The file has been added to your download list."),QMessageBox::Information,QMessageBox::Ok,0,0);
|
||||
mb.setButtonText( QMessageBox::Ok, "OK" );
|
||||
mb.setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png")));
|
||||
mb.exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox mb(tr("File Request canceled"), tr("The file has not been added to your download list, because you already have it."),QMessageBox::Information,QMessageBox::Ok,0,0);
|
||||
mb.setButtonText( QMessageBox::Ok, "OK" );
|
||||
mb.exec();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox mb(tr("File Request Error"), tr("The file link is malformed."),QMessageBox::Information,QMessageBox::Ok,0,0);
|
||||
mb.setButtonText( QMessageBox::Ok, "OK" );
|
||||
mb.setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png")));
|
||||
mb.exec();
|
||||
}
|
||||
}
|
||||
else if (link.scheme() == "http")
|
||||
{
|
||||
QDesktopServices::openUrl(link);
|
||||
}
|
||||
else if (link.scheme() == "")
|
||||
{
|
||||
//it's probably a web adress, let's add http:// at the beginning of the link
|
||||
QString newAddress = link.toString();
|
||||
newAddress.prepend("http://");
|
||||
QDesktopServices::openUrl(QUrl(newAddress));
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,8 @@ void checkAnon();
|
||||
|
||||
void checkUpdate();
|
||||
|
||||
void anchorClicked (const QUrl &);
|
||||
|
||||
private:
|
||||
|
||||
void updateComments(std::string rid, std::string pid);
|
||||
|
@ -60,7 +60,7 @@
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -71,7 +71,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="3" column="1">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -84,7 +84,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -98,11 +98,11 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<item row="3" column="3">
|
||||
<widget class="QComboBox" name="rankComboBox">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<item>
|
||||
@ -114,15 +114,23 @@
|
||||
<property name="text">
|
||||
<string>Time</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/kalarm.png</normaloff>:/images/kalarm.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ranking</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/records.png</normaloff>:/images/records.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<item row="3" column="4">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -135,7 +143,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<item row="3" column="5">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -149,31 +157,43 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<item row="3" column="6">
|
||||
<widget class="QComboBox" name="periodComboBox">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Month</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/view_calendar_month.png</normaloff>:/images/view_calendar_month.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Week</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/view_calendar_week.png</normaloff>:/images/view_calendar_week.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Day</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/view_calendar_day.png</normaloff>:/images/view_calendar_day.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<item row="3" column="7">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -186,7 +206,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="8">
|
||||
<item row="3" column="8">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -200,26 +220,34 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="9">
|
||||
<item row="3" column="9">
|
||||
<widget class="QComboBox" name="fromComboBox">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>All Peers</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/user/friends24.png</normaloff>:/images/user/friends24.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Own Links</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/user/identity16.png</normaloff>:/images/user/identity16.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="10">
|
||||
<item row="3" column="10">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -232,7 +260,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="11">
|
||||
<item row="3" column="11">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -246,17 +274,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="12">
|
||||
<item row="3" column="12">
|
||||
<widget class="QComboBox" name="topComboBox">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Top 100</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/records.png</normaloff>:/images/records.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -285,6 +317,40 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="12">
|
||||
<widget class="QTextBrowser" name="linklabel">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QTextBrowser{border: 2px solid #CCCCCC;
|
||||
border-radius: 10px;
|
||||
background: white;}</string>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="openLinks">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Link:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
@ -308,7 +374,7 @@
|
||||
<widget class="QCheckBox" name="anonBox">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<pointsize>11</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
@ -322,7 +388,7 @@
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -338,9 +404,9 @@
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -352,18 +418,23 @@
|
||||
<widget class="QLineEdit" name="titleLineEdit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLineEdit{border: 2px solid #CCCCCC;
|
||||
border-radius: 10px;
|
||||
background: white;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -428,9 +499,9 @@
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -442,9 +513,14 @@
|
||||
<widget class="QLineEdit" name="linkLineEdit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLineEdit{border: 2px solid #CCCCCC;
|
||||
border-radius: 10px;
|
||||
background: white;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -468,6 +544,11 @@
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QTextEdit{border: 2px solid #CCCCCC;
|
||||
border-radius: 10px;
|
||||
background: white;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
Loading…
Reference in New Issue
Block a user