1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor: remove another function from Nexus

This commit is contained in:
sudden6 2018-10-31 01:59:22 +01:00
parent 6097c3f94f
commit de773efec7
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
4 changed files with 17 additions and 17 deletions

View File

@ -284,15 +284,6 @@ Widget* Nexus::getDesktopGUI()
return getInstance().widget;
}
QString Nexus::getSupportedImageFilter()
{
QString res;
for (auto type : QImageReader::supportedImageFormats())
res += QString("*.%1 ").arg(QString(type));
return tr("Images (%1)", "filetype filter").arg(res.left(res.size() - 1));
}
/**
* @brief Dangerous way to find out if a path is writable.
* @param filepath Path to file which should be deleted.

View File

@ -49,7 +49,6 @@ public:
static Profile* getProfile();
static void setProfile(Profile* profile);
static Widget* getDesktopGUI();
static QString getSupportedImageFilter();
static bool tryRemoveFile(const QString& filepath);
public slots:

View File

@ -22,7 +22,6 @@
#include "src/core/core.h"
#include "src/model/profile/iprofileinfo.h"
#include "src/net/toxme.h"
#include "src/nexus.h"
#include "src/persistence/profile.h"
#include "src/persistence/profilelocker.h"
#include "src/persistence/settings.h"
@ -41,6 +40,7 @@
#include <QComboBox>
#include <QFileDialog>
#include <QGroupBox>
#include <QImageReader>
#include <QInputDialog>
#include <QLabel>
#include <QLineEdit>
@ -310,9 +310,19 @@ void ProfileForm::setToxId(const ToxId& id)
bodyUI->qrCode->setPixmap(QPixmap::fromImage(qr->getImage()->scaledToWidth(150)));
}
QString ProfileForm::getSupportedImageFilter()
{
QString res;
for (auto type : QImageReader::supportedImageFormats()) {
res += QString("*.%1 ").arg(QString(type));
}
return tr("Images (%1)", "filetype filter").arg(res.left(res.size() - 1));
}
void ProfileForm::onAvatarClicked()
{
const QString filter = Nexus::getSupportedImageFilter();
const QString filter = getSupportedImageFilter();
const QString path = QFileDialog::getOpenFileName(Q_NULLPTR, tr("Choose a profile picture"),
QDir::homePath(), filter, nullptr);

View File

@ -20,7 +20,6 @@
#ifndef IDENTITYFORM_H
#define IDENTITYFORM_H
#include "src/core/core.h"
#include "src/widget/qrwidget.h"
#include <QLabel>
#include <QLineEdit>
@ -35,7 +34,7 @@ class MaskablePixmapWidget;
namespace Ui {
class IdentitySettings;
}
class ToxId;
class ClickableTE : public QLabel
{
Q_OBJECT
@ -87,10 +86,12 @@ private:
void showExistingToxme();
void retranslateUi();
void prFileLabelUpdate();
private:
bool eventFilter(QObject* object, QEvent* event);
void refreshProfiles();
void showRegisterToxme();
static QString getSupportedImageFilter();
private:
Ui::IdentitySettings* bodyUI;
MaskablePixmapWidget* profilePicture;
QTimer timer;
@ -98,7 +99,6 @@ private:
QRWidget* qr;
ClickableTE* toxId;
IProfileInfo* profileInfo;
void showRegisterToxme();
};
#endif