mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
A few teaks... sadly, it doesn't quite work for now
See the comment in filesform.cpp Also Flynn, a better matching icon is required
This commit is contained in:
parent
e0b6fd1e13
commit
310fd21123
1
res.qrc
1
res.qrc
|
@ -26,6 +26,7 @@
|
|||
<file>img/add.png</file>
|
||||
<file>img/settings.png</file>
|
||||
<file>img/transfer.png</file>
|
||||
<file>img/checkmark.png</file>
|
||||
<file>ui/acceptFileButton/default.png</file>
|
||||
<file>ui/acceptFileButton/hover.png</file>
|
||||
<file>ui/acceptFileButton/pressed.png</file>
|
||||
|
|
|
@ -30,7 +30,8 @@ FilesForm::FilesForm()
|
|||
main.addTab(&recvd, tr("Downloads"));
|
||||
main.addTab(&sent, tr("Uploads"));
|
||||
|
||||
connect(&sent, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(onFileActivated(QListWidgetItem*)));
|
||||
connect(&sent, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(onUploadFileActivated(QListWidgetItem*)));
|
||||
connect(&recvd, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(onDownloadFileActivated(QListWidgetItem*)));
|
||||
|
||||
}
|
||||
|
||||
|
@ -52,17 +53,31 @@ void FilesForm::show(Ui::Widget& ui)
|
|||
|
||||
void FilesForm::onFileDownloadComplete(const QString& path)
|
||||
{
|
||||
QListWidgetItem* tmp = new QListWidgetItem(/*QIcon("checkmark.png"),*/path);
|
||||
QListWidgetItem* tmp = new QListWidgetItem(QIcon(":/img/checkmark.png"), path);
|
||||
recvd.addItem(tmp);
|
||||
}
|
||||
|
||||
void FilesForm::onFileUploadComplete(const QString& path)
|
||||
{
|
||||
QListWidgetItem* tmp = new QListWidgetItem(/*QIcon("checkmark.png"),*/path);
|
||||
QListWidgetItem* tmp = new QListWidgetItem(QIcon(":/img/checkmark.png"), path);
|
||||
sent.addItem(tmp);
|
||||
}
|
||||
|
||||
void FilesForm::onFileActivated(QListWidgetItem* item)
|
||||
// sadly, the ToxFile struct in core only has the file name, not the file path...
|
||||
// so currently, these don't work as intended (though for now, downloads might work
|
||||
// whenever they're not saved anywhere custom, thanks to the hack)
|
||||
// I could do some digging around, but for now I'm tired and others already
|
||||
// might know it without me needing to dig, so...
|
||||
void FilesForm::onDownloadFileActivated(QListWidgetItem* item)
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(item->text()));
|
||||
QUrl url = QUrl::fromLocalFile("./" + item->text());
|
||||
qDebug() << "Opening '" << url << "'";
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
||||
void FilesForm::onUploadFileActivated(QListWidgetItem* item)
|
||||
{
|
||||
QUrl url = QUrl::fromLocalFile(item->text());
|
||||
qDebug() << "Opening '" << url << "'";
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
|
||||
class FilesForm : public QObject
|
||||
{
|
||||
|
@ -42,10 +43,11 @@ public slots:
|
|||
void onFileUploadComplete(const QString& path);
|
||||
|
||||
private slots:
|
||||
void onFileActivated(QListWidgetItem* item);
|
||||
void onDownloadFileActivated(QListWidgetItem* item);
|
||||
void onUploadFileActivated(QListWidgetItem* item);
|
||||
|
||||
private:
|
||||
QWidget *head;
|
||||
QWidget* head;
|
||||
QLabel headLabel;
|
||||
QVBoxLayout headLayout;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user