mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-02 02:24:58 -05:00
gui: file: add power to change font size for displayed shared files
Added one more settings group "File".
This commit is contained in:
parent
ed0ea3aa01
commit
ca0a441f3b
@ -241,10 +241,6 @@ SharedFilesDialog::SharedFilesDialog(bool remote_mode, QWidget *parent)
|
||||
/* Set Multi Selection */
|
||||
ui.dirTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
QFontMetricsF fontMetrics(ui.dirTreeView->font());
|
||||
int iconHeight = fontMetrics.height() * 1.5;
|
||||
ui.dirTreeView->setIconSize(QSize(iconHeight, iconHeight));
|
||||
|
||||
/* Hide platform specific features */
|
||||
copylinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Links to Clipboard" ), this );
|
||||
connect( copylinkAct , SIGNAL( triggered() ), this, SLOT( copyLink() ) );
|
||||
@ -323,7 +319,7 @@ void SharedFilesDialog::hideEvent(QHideEvent *)
|
||||
model->setVisible(false) ;
|
||||
}
|
||||
|
||||
void SharedFilesDialog::showEvent(QShowEvent *)
|
||||
void SharedFilesDialog::showEvent(QShowEvent *event)
|
||||
{
|
||||
if(model!=NULL)
|
||||
{
|
||||
@ -336,6 +332,10 @@ void SharedFilesDialog::showEvent(QShowEvent *)
|
||||
|
||||
restoreExpandedPathsAndSelection(expanded_indexes,hidden_indexes,selected_indexes);
|
||||
}
|
||||
|
||||
if (!event->spontaneous()) {
|
||||
updateFontSize();
|
||||
}
|
||||
}
|
||||
RemoteSharedFilesDialog::~RemoteSharedFilesDialog()
|
||||
{
|
||||
@ -1686,3 +1686,16 @@ bool SharedFilesDialog::tree_FilterItem(const QModelIndex &index, const QString
|
||||
return (visible || visibleChildCount);
|
||||
}
|
||||
#endif
|
||||
|
||||
void SharedFilesDialog::updateFontSize()
|
||||
{
|
||||
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 11).toInt();
|
||||
QFont newFont = ui.dirTreeView->font();
|
||||
if (newFont.pointSize() != customFontSize) {
|
||||
newFont.setPointSize(customFontSize);
|
||||
QFontMetricsF fontMetrics(newFont);
|
||||
int iconHeight = fontMetrics.height();
|
||||
ui.dirTreeView->setFont(newFont);
|
||||
ui.dirTreeView->setIconSize(QSize(iconHeight, iconHeight));
|
||||
}
|
||||
}
|
||||
|
@ -117,6 +117,8 @@ protected:
|
||||
|
||||
QModelIndexList getSelected();
|
||||
|
||||
void updateFontSize();
|
||||
|
||||
/** Defines the actions for the context menu for QTreeWidget */
|
||||
QAction* copylinkAct;
|
||||
QAction* sendlinkAct;
|
||||
|
@ -356,11 +356,6 @@ border-image: url(:/images/closepressed.png)
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
|
@ -53,6 +53,7 @@ TransferPage::TransferPage(QWidget * parent, Qt::WindowFlags flags)
|
||||
QObject::connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) );
|
||||
QObject::connect(ui.editShareButton, SIGNAL(clicked()), this, SLOT(editDirectories()));
|
||||
QObject::connect(ui.autoCheckDirectories_CB, SIGNAL(clicked(bool)), this, SLOT(toggleAutoCheckDirectories(bool)));
|
||||
QObject::connect(ui.minimumFontSize_SB, SIGNAL(valueChanged(int)), this, SLOT(updateFontSize())) ;
|
||||
|
||||
QObject::connect(ui.autoCheckDirectories_CB, SIGNAL(toggled(bool)), this,SLOT(updateAutoCheckDirectories())) ;
|
||||
QObject::connect(ui.autoCheckDirectoriesDelay_SB,SIGNAL(valueChanged(int)),this,SLOT(updateAutoScanDirectoriesPeriod())) ;
|
||||
@ -188,6 +189,10 @@ void TransferPage::load()
|
||||
whileBlocking(ui.suffixesIgnoreList_CB)->setChecked( ignore_flags & RS_FILE_SHARE_FLAGS_IGNORE_SUFFIXES ) ;
|
||||
whileBlocking(ui.prefixesIgnoreList_LE)->setText( ignore_prefixes_string );
|
||||
whileBlocking(ui.suffixesIgnoreList_LE)->setText( ignore_suffixes_string );
|
||||
|
||||
Settings->beginGroup(QString("File"));
|
||||
whileBlocking(ui.minimumFontSize_SB)->setValue( Settings->value("MinimumFontSize", 11 ).toInt());
|
||||
Settings->endGroup();
|
||||
}
|
||||
|
||||
void TransferPage::updateDefaultStrategy(int i)
|
||||
@ -290,6 +295,13 @@ void TransferPage::editDirectories()
|
||||
ShareManager::showYourself() ;
|
||||
}
|
||||
|
||||
void TransferPage::updateFontSize()
|
||||
{
|
||||
Settings->beginGroup(QString("File"));
|
||||
Settings->setValue("MinimumFontSize", ui.minimumFontSize_SB->value());
|
||||
Settings->endGroup();
|
||||
}
|
||||
|
||||
void TransferPage::updateAutoCheckDirectories() { rsFiles->setWatchEnabled(ui.autoCheckDirectories_CB->isChecked()) ; }
|
||||
void TransferPage::updateAutoScanDirectoriesPeriod() { rsFiles->setWatchPeriod(ui.autoCheckDirectoriesDelay_SB->value()); }
|
||||
void TransferPage::updateShareDownloadDirectory() { rsFiles->shareDownloadDirectory(ui.shareDownloadDirectoryCB->isChecked());}
|
||||
|
@ -58,6 +58,7 @@ class TransferPage: public ConfigPage
|
||||
void updateAutoDLColl();
|
||||
void setPartialsDirectory();
|
||||
void toggleAutoCheckDirectories(bool);
|
||||
void updateFontSize();
|
||||
|
||||
void updateAutoCheckDirectories() ;
|
||||
void updateAutoScanDirectoriesPeriod() ;
|
||||
|
@ -299,6 +299,40 @@ p, li { white-space: pre-wrap; }
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<layout class="QHBoxLayout" name="minimumFontSizeHLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="minimumFontSizeLabel">
|
||||
<property name="text">
|
||||
<string>Minimum font size for Shared Files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="minimumFontSize_SB">
|
||||
<property name="minimum">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>64</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="minimumFontSizeHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
Loading…
x
Reference in New Issue
Block a user