mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(widget): remove usage of Core::getInstance
This commit is contained in:
parent
728621f627
commit
c1ec6bc649
|
@ -107,8 +107,9 @@ bool tryRemoveFile(const QString& filepath)
|
|||
tmp.remove();
|
||||
return writable;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void acceptFileTransfer(const ToxFile& file, const QString& path)
|
||||
void Widget::acceptFileTransfer(const ToxFile& file, const QString& path)
|
||||
{
|
||||
QString filepath;
|
||||
int number = 0;
|
||||
|
@ -127,13 +128,12 @@ void acceptFileTransfer(const ToxFile& file, const QString& path)
|
|||
// Do not automatically accept the file-transfer if the path is not writable.
|
||||
// The user can still accept it manually.
|
||||
if (tryRemoveFile(filepath)) {
|
||||
CoreFile* coreFile = Core::getInstance()->getCoreFile();
|
||||
CoreFile* coreFile = core->getCoreFile();
|
||||
coreFile->acceptFileRecvRequest(file.friendId, file.fileNum, filepath);
|
||||
} else {
|
||||
qWarning() << "Cannot write to " << filepath;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Widget* Widget::instance{nullptr};
|
||||
|
||||
|
@ -1077,7 +1077,7 @@ void Widget::dispatchFile(ToxFile file)
|
|||
|
||||
if (file.status == ToxFile::INITIALIZING && file.direction == ToxFile::RECEIVING) {
|
||||
auto sender =
|
||||
(file.direction == ToxFile::SENDING) ? Core::getInstance()->getSelfPublicKey() : pk;
|
||||
(file.direction == ToxFile::SENDING) ? core->getSelfPublicKey() : pk;
|
||||
|
||||
const Settings& settings = Settings::getInstance();
|
||||
QString autoAcceptDir = settings.getAutoAcceptDir(f->getPublicKey());
|
||||
|
|
|
@ -275,6 +275,7 @@ private:
|
|||
void openDialog(GenericChatroomWidget* widget, bool newWindow);
|
||||
void playNotificationSound(IAudioSink::Sound sound, bool loop = false);
|
||||
void cleanupNotificationSound();
|
||||
void acceptFileTransfer(const ToxFile &file, const QString &path);
|
||||
|
||||
private:
|
||||
std::unique_ptr<QSystemTrayIcon> icon;
|
||||
|
|
Loading…
Reference in New Issue
Block a user