Browse Source

refactor: remove another function from Nexus

reviewable/pr5418/r2
sudden6 7 years ago
parent
commit
de773efec7
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
  1. 9
      src/nexus.cpp
  2. 1
      src/nexus.h
  3. 14
      src/widget/form/profileform.cpp
  4. 10
      src/widget/form/profileform.h

9
src/nexus.cpp

@ -284,15 +284,6 @@ Widget* Nexus::getDesktopGUI() @@ -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.

1
src/nexus.h

@ -49,7 +49,6 @@ public: @@ -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:

14
src/widget/form/profileform.cpp

@ -22,7 +22,6 @@ @@ -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 @@ @@ -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) @@ -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);

10
src/widget/form/profileform.h

@ -20,7 +20,6 @@ @@ -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; @@ -35,7 +34,7 @@ class MaskablePixmapWidget;
namespace Ui {
class IdentitySettings;
}
class ToxId;
class ClickableTE : public QLabel
{
Q_OBJECT
@ -87,10 +86,12 @@ private: @@ -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: @@ -98,7 +99,6 @@ private:
QRWidget* qr;
ClickableTE* toxId;
IProfileInfo* profileInfo;
void showRegisterToxme();
};
#endif

Loading…
Cancel
Save