mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-23 14:39:34 -05:00
Merge pull request #2718 from defnax/wirefixes10
Picture attachments improved [Wire]
This commit is contained in:
commit
669982bc5b
@ -42,15 +42,26 @@ PulseAddDialog::PulseAddDialog(QWidget *parent)
|
||||
connect(ui.pushButton_Cancel, SIGNAL( clicked( void ) ), this, SLOT( cancelPulse( void ) ) );
|
||||
connect(ui.textEdit_Pulse, SIGNAL( textChanged( void ) ), this, SLOT( pulseTextChanged( void ) ) );
|
||||
connect(ui.pushButton_picture, SIGNAL(clicked()), this, SLOT( toggle()));
|
||||
connect(ui.pushButton_remove, SIGNAL(clicked()), this, SLOT( removePictures()));
|
||||
|
||||
|
||||
// this connection is from browse push button to the slot function onBrowseButtonClicked()
|
||||
connect(ui.pushButton_Browse, SIGNAL(clicked()), this, SLOT( onBrowseButtonClicked()));
|
||||
|
||||
ui.pushButton_picture->setIcon(FilesDefs::getIconFromQtResourcePath(QString(":/icons/png/photo.png")));
|
||||
ui.pushButton_Browse->setIcon(FilesDefs::getIconFromQtResourcePath(QString(":/icons/png/add-image.png")));
|
||||
ui.pushButton_remove->setIcon(FilesDefs::getIconFromQtResourcePath(QString(":/icons/mail/delete.png")));
|
||||
|
||||
ui.frame_picture->hide();
|
||||
ui.pushButton_picture->hide();
|
||||
|
||||
// initially hiding the browse button as the attach image button is not pressed
|
||||
ui.frame_PictureBrowse->hide();
|
||||
//ui.frame_PictureBrowse->hide();
|
||||
|
||||
ui.label_image1->hide();
|
||||
ui.label_image2->hide();
|
||||
ui.label_image3->hide();
|
||||
ui.label_image4->hide();
|
||||
|
||||
setAcceptDrops(true);
|
||||
}
|
||||
@ -160,11 +171,10 @@ void PulseAddDialog::cleanup()
|
||||
ui.label_image4->clear();
|
||||
ui.label_image4->setText(tr("Drag and Drop Image"));
|
||||
|
||||
ui.lineEdit_FilePath->clear();
|
||||
|
||||
// Hide Drag & Drop Frame and the browse frame
|
||||
ui.frame_picture->hide();
|
||||
ui.frame_PictureBrowse->hide();
|
||||
//ui.frame_PictureBrowse->hide();
|
||||
ui.pushButton_picture->hide();
|
||||
|
||||
ui.pushButton_picture->setChecked(false);
|
||||
}
|
||||
@ -489,24 +499,29 @@ void PulseAddDialog::addImage(const QString &path)
|
||||
std::cerr << "PulseAddDialog::addImage() Installing in Image1";
|
||||
std::cerr << std::endl;
|
||||
ui.label_image1->setPixmap(icon);
|
||||
ui.label_image1->show();
|
||||
ui.frame_picture->show();
|
||||
mImage1.copy((uint8_t *) ba.data(), ba.size());
|
||||
std::cerr << "PulseAddDialog::addImage() Installing in Image1 Size: " << mImage1.mSize;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else if (mImage2.empty()) {
|
||||
ui.label_image2->setPixmap(icon);
|
||||
ui.label_image2->show();
|
||||
mImage2.copy((uint8_t *) ba.data(), ba.size());
|
||||
std::cerr << "PulseAddDialog::addImage() Installing in Image2 Size: " << mImage2.mSize;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else if (mImage3.empty()) {
|
||||
ui.label_image3->setPixmap(icon);
|
||||
ui.label_image3->show();
|
||||
mImage3.copy((uint8_t *) ba.data(), ba.size());
|
||||
std::cerr << "PulseAddDialog::addImage() Installing in Image3 Size: " << mImage3.mSize;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else if (mImage4.empty()) {
|
||||
ui.label_image4->setPixmap(icon);
|
||||
ui.label_image4->show();
|
||||
mImage4.copy((uint8_t *) ba.data(), ba.size());
|
||||
std::cerr << "PulseAddDialog::addImage() Installing in Image4 Size: " << mImage4.mSize;
|
||||
std::cerr << std::endl;
|
||||
@ -523,7 +538,6 @@ void PulseAddDialog::toggle()
|
||||
{
|
||||
// Show the input methods (drag and drop field and the browse button)
|
||||
ui.frame_picture->show();
|
||||
ui.frame_PictureBrowse->show();
|
||||
|
||||
ui.pushButton_picture->setToolTip(tr("Hide Pictures"));
|
||||
}
|
||||
@ -531,7 +545,6 @@ void PulseAddDialog::toggle()
|
||||
{
|
||||
// Hide the input methods (drag and drop field and the browse button)
|
||||
ui.frame_picture->hide();
|
||||
ui.frame_PictureBrowse->hide();
|
||||
|
||||
ui.pushButton_picture->setToolTip(tr("Add Pictures"));
|
||||
}
|
||||
@ -543,8 +556,27 @@ void PulseAddDialog::onBrowseButtonClicked()
|
||||
QString filePath;
|
||||
misc::getOpenFileName(this, RshareSettings::LASTDIR_IMAGES, tr("Load Picture File"), "Pictures (*.png *.xpm *.jpg *.jpeg *.gif *.webp )", filePath);
|
||||
if (!filePath.isEmpty()) {
|
||||
ui.lineEdit_FilePath->setText(filePath);
|
||||
//ui.lineEdit_FilePath->setText(filePath);
|
||||
addImage(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
void PulseAddDialog::removePictures()
|
||||
{
|
||||
|
||||
mImage1.clear();
|
||||
ui.label_image1->clear();
|
||||
mImage2.clear();
|
||||
ui.label_image2->clear();
|
||||
mImage3.clear();
|
||||
ui.label_image3->clear();
|
||||
mImage4.clear();
|
||||
ui.label_image4->clear();
|
||||
|
||||
ui.label_image1->hide();
|
||||
ui.label_image2->hide();
|
||||
ui.label_image3->hide();
|
||||
ui.label_image4->hide();
|
||||
|
||||
ui.frame_picture->hide();
|
||||
}
|
||||
|
@ -53,7 +53,8 @@ private slots:
|
||||
void clearDialog();
|
||||
void pulseTextChanged();
|
||||
void toggle();
|
||||
void onBrowseButtonClicked();
|
||||
void onBrowseButtonClicked();
|
||||
void removePictures();
|
||||
|
||||
private:
|
||||
// OLD VERSIONs, private now.
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>720</width>
|
||||
<width>735</width>
|
||||
<height>513</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -52,6 +52,7 @@
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
@ -249,6 +250,12 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_picture">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -278,6 +285,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_image4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Drag and Drop Image</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_image3">
|
||||
<property name="minimumSize">
|
||||
@ -310,63 +333,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_image4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
<item row="0" column="2" rowspan="2">
|
||||
<widget class="QToolButton" name="pushButton_remove">
|
||||
<property name="toolTip">
|
||||
<string>Remove all images</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Drag and Drop Image</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_PictureBrowse">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_FilePath">
|
||||
<property name="minimumSize">
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>541</width>
|
||||
<height>25</height>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Browse">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>101</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -413,7 +395,6 @@
|
||||
</layout>
|
||||
<zorder>frame_URL</zorder>
|
||||
<zorder>frame_picture</zorder>
|
||||
<zorder>frame_PictureBrowse</zorder>
|
||||
<zorder>textEdit_Pulse</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
@ -423,7 +404,7 @@
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_picture">
|
||||
<widget class="QToolButton" name="pushButton_picture">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
@ -438,6 +419,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="pushButton_Browse">
|
||||
<property name="toolTip">
|
||||
<string>Add Picture</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="buttonHSpacer">
|
||||
<property name="orientation">
|
||||
@ -456,6 +453,7 @@
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
|
Loading…
Reference in New Issue
Block a user