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

remove files that I shouldn't have added in the first place

This commit is contained in:
Dubslow 2014-12-05 19:17:02 -06:00
parent 4e1a204bc0
commit 2e6b0f7b2b
No known key found for this signature in database
GPG Key ID: 3DB8E05315C220AA
9 changed files with 23 additions and 77 deletions

View File

@ -163,8 +163,7 @@ HEADERS += src/widget/form/addfriendform.h \
src/autoupdate.h \ src/autoupdate.h \
src/misc/serialize.h \ src/misc/serialize.h \
src/widget/form/settings/advancedform.h \ src/widget/form/settings/advancedform.h \
src/audio.h \ src/audio.h
src/widget/form/checkcontinue.h
SOURCES += \ SOURCES += \
src/widget/form/addfriendform.cpp \ src/widget/form/addfriendform.cpp \
@ -231,8 +230,7 @@ SOURCES += \
src/autoupdate.cpp \ src/autoupdate.cpp \
src/misc/serialize.cpp \ src/misc/serialize.cpp \
src/widget/form/settings/advancedform.cpp \ src/widget/form/settings/advancedform.cpp \
src/audio.cpp \ src/audio.cpp
src/widget/form/checkcontinue.cpp
contains(DEFINES, QTOX_PLATFORM_EXT) { contains(DEFINES, QTOX_PLATFORM_EXT) {
HEADERS += src/platform/timer.h HEADERS += src/platform/timer.h

View File

@ -427,8 +427,8 @@ void AutoUpdater::checkUpdatesAsyncInteractiveWorker()
if (!isUpdateAvailable()) if (!isUpdateAvailable())
return; return;
if (Widget::getInstance()->askMsgboxQuestion(QObject::tr("Update", "The title of a message box"), if (Widget::getInstance()->askQuestion(QObject::tr("Update", "The title of a message box"),
QObject::tr("An update is available, do you want to download it now?\nIt will be installed when qTox restarts."))) QObject::tr("An update is available, do you want to download it now?\nIt will be installed when qTox restarts."), false))
{ {
downloadUpdate(); downloadUpdate();
} }

View File

@ -1,23 +0,0 @@
/*
Copyright (C) 2014 by Project Tox <https://tox.im>
This file is part of qTox, a Qt-based graphical interface for Tox.
This program is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the COPYING file for more details.
*/
#include <QMessageBox>
bool checkContinue(const QString& title, const QString& msg, QWidget* parent = nullptr)
{
QMessageBox::StandardButton resp = QMessageBox::question(parent, title, msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
return resp == QMessageBox::Yes;
}

View File

@ -1,22 +0,0 @@
/*
Copyright (C) 2014 by Project Tox <https://tox.im>
This file is part of qTox, a Qt-based graphical interface for Tox.
This program is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the COPYING file for more details.
*/
#ifndef CHECKCONTINUE_H
#define CHECKCONTINUE_H
bool checkContinue(const QString& title, const QString& msg, QWidget* parent = nullptr);
#endif

View File

@ -20,7 +20,6 @@
#include "src/widget/form/settingswidget.h" #include "src/widget/form/settingswidget.h"
#include "src/misc/settings.h" #include "src/misc/settings.h"
#include "src/widget/croppinglabel.h" #include "src/widget/croppinglabel.h"
#include "src/widget/form/checkcontinue.h"
#include "src/widget/widget.h" #include "src/widget/widget.h"
#include "src/historykeeper.h" #include "src/historykeeper.h"
#include "src/misc/style.h" #include "src/misc/style.h"
@ -148,8 +147,8 @@ void IdentityForm::onRenameClicked()
name = Core::sanitize(name); name = Core::sanitize(name);
QDir dir(Settings::getSettingsDirPath()); QDir dir(Settings::getSettingsDirPath());
QString file = dir.filePath(name+Core::TOX_EXT); QString file = dir.filePath(name+Core::TOX_EXT);
if (!QFile::exists(file) || checkContinue(tr("Profile already exists", "rename confirm title"), if (!QFile::exists(file) || Widget::getInstance()->askQuestion(tr("Profile already exists", "rename confirm title"),
tr("A profile named \"%1\" already exists. Do you want to erase it?", "rename confirm text").arg(cur)), this) tr("A profile named \"%1\" already exists. Do you want to erase it?", "rename confirm text").arg(cur)))
{ {
QFile::rename(dir.filePath(cur+Core::TOX_EXT), file); QFile::rename(dir.filePath(cur+Core::TOX_EXT), file);
bodyUI->profiles->setItemText(bodyUI->profiles->currentIndex(), name); bodyUI->profiles->setItemText(bodyUI->profiles->currentIndex(), name);
@ -172,8 +171,6 @@ void IdentityForm::onExportClicked()
if (QFile::exists(path)) if (QFile::exists(path))
{ {
// should we popup a warning? // should we popup a warning?
// if (!checkContinue(tr("Overwriting a file"), tr("Are you sure you want to overwrite %1?").arg(path)), this)
// return;
success = QFile::remove(path); success = QFile::remove(path);
if (!success) if (!success)
{ {
@ -195,8 +192,8 @@ void IdentityForm::onDeleteClicked()
} }
else else
{ {
if (checkContinue(tr("Deletion imminent!","deletion confirmation title"), if (Widget::getInstance()->askQuestion(tr("Deletion imminent!","deletion confirmation title"),
tr("Are you sure you want to delete this profile?","deletion confirmation text"), this)) tr("Are you sure you want to delete this profile?","deletion confirmation text")))
{ {
QString profile = bodyUI->profiles->currentText(); QString profile = bodyUI->profiles->currentText();
QDir dir(Settings::getSettingsDirPath()); QDir dir(Settings::getSettingsDirPath());
@ -234,8 +231,8 @@ void IdentityForm::onImportClicked()
QString profilePath = QDir(Settings::getSettingsDirPath()).filePath(profile + Core::TOX_EXT); QString profilePath = QDir(Settings::getSettingsDirPath()).filePath(profile + Core::TOX_EXT);
if (QFileInfo(profilePath).exists() && !checkContinue(tr("Profile already exists", "import confirm title"), if (QFileInfo(profilePath).exists() && !Widget::getInstance()->askQuestion(tr("Profile already exists", "import confirm title"),
tr("A profile named \"%1\" already exists. Do you want to erase it?", "import confirm text").arg(profile), this)) tr("A profile named \"%1\" already exists. Do you want to erase it?", "import confirm text").arg(profile)))
return; return;
QFile::copy(path, profilePath); QFile::copy(path, profilePath);

View File

@ -22,7 +22,6 @@
#include "src/core.h" #include "src/core.h"
#include "src/widget/widget.h" #include "src/widget/widget.h"
#include "src/widget/form/setpassworddialog.h" #include "src/widget/form/setpassworddialog.h"
#include "src/widget/form/checkcontinue.h"
#include <QMessageBox> #include <QMessageBox>
#include <QFile> #include <QFile>
#include <QDebug> #include <QDebug>
@ -122,7 +121,7 @@ void PrivacyForm::onEncryptLogsUpdated()
} }
else else
{ {
if (checkContinue(tr("Old encrypted chat logs", "title"), tr("Would you like to un-encrypt your chat logs?\nOtherwise they will be deleted."))) if (Widget::getInstance()->askQuestion(tr("Old encrypted chat logs", "title"), tr("Would you like to un-encrypt your chat logs?\nOtherwise they will be deleted."), false))
{ {
QList<HistoryKeeper::HistMessage> oldMessages = HistoryKeeper::exportMessagesDeleteFile(true); QList<HistoryKeeper::HistMessage> oldMessages = HistoryKeeper::exportMessagesDeleteFile(true);
core->clearPassword(Core::ptHistory); core->clearPassword(Core::ptHistory);

View File

@ -18,7 +18,6 @@
#include "widget.h" #include "widget.h"
#include "src/core.h" #include "src/core.h"
#include "src/misc/settings.h" #include "src/misc/settings.h"
#include "src/widget/form/checkcontinue.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
@ -62,7 +61,7 @@ void handleToxSave(const QString& path)
QString profilePath = QDir(Settings::getSettingsDirPath()).filePath(profile + Core::TOX_EXT); QString profilePath = QDir(Settings::getSettingsDirPath()).filePath(profile + Core::TOX_EXT);
if (QFileInfo(profilePath).exists() && !checkContinue(QObject::tr("Profile already exists", "import confirm title"), if (QFileInfo(profilePath).exists() && !Widget::getInstance()->askQuestion(QObject::tr("Profile already exists", "import confirm title"),
QObject::tr("A profile named \"%1\" already exists. Do you want to erase it?", "import confirm text").arg(profile))) QObject::tr("A profile named \"%1\" already exists. Do you want to erase it?", "import confirm text").arg(profile)))
return; return;

View File

@ -1186,21 +1186,17 @@ void Widget::onSplitterMoved(int pos, int index)
saveSplitterGeometry(); saveSplitterGeometry();
} }
QMessageBox::StandardButton Widget::showWarningMsgBox(const QString& title, const QString& msg, QMessageBox::StandardButtons buttons) void Widget::showWarningMsgBox(const QString& title, const QString& msg)
{ {
// We can only display widgets from the GUI thread // We can only display widgets from the GUI thread
if (QThread::currentThread() != qApp->thread()) if (QThread::currentThread() != qApp->thread())
{ {
QMessageBox::StandardButton ret;
QMetaObject::invokeMethod(this, "showWarningMsgBox", Qt::BlockingQueuedConnection, QMetaObject::invokeMethod(this, "showWarningMsgBox", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(QMessageBox::StandardButton, ret), Q_ARG(const QString&, title), Q_ARG(const QString&, msg));
Q_ARG(const QString&, title), Q_ARG(const QString&, msg),
Q_ARG(QMessageBox::StandardButtons, buttons));
return ret;
} }
else else
{ {
return QMessageBox::warning(this, title, msg, buttons); QMessageBox::warning(this, title, msg);
} }
} }
@ -1219,7 +1215,7 @@ void Widget::setEnabledThreadsafe(bool enabled)
} }
} }
bool Widget::askMsgboxQuestion(const QString& title, const QString& msg) bool Widget::askQuestion(const QString& title, const QString& msg, bool warning)
{ {
// We can only display widgets from the GUI thread // We can only display widgets from the GUI thread
if (QThread::currentThread() != qApp->thread()) if (QThread::currentThread() != qApp->thread())
@ -1227,12 +1223,15 @@ bool Widget::askMsgboxQuestion(const QString& title, const QString& msg)
bool ret; bool ret;
QMetaObject::invokeMethod(this, "askMsgboxQuestion", Qt::BlockingQueuedConnection, QMetaObject::invokeMethod(this, "askMsgboxQuestion", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(bool, ret), Q_RETURN_ARG(bool, ret),
Q_ARG(const QString&, title), Q_ARG(const QString&, msg)); Q_ARG(const QString&, title), Q_ARG(const QString&, msg), Q_ARG(bool, warning));
return ret; return ret;
} }
else else
{ {
return QMessageBox::question(this, title, msg) == QMessageBox::StandardButton::Yes; if (warning)
return QMessageBox::warning(this, title, msg, QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::StandardButton::Ok;
else
return QMessageBox::question(this, title, msg) == QMessageBox::StandardButton::Yes;
} }
} }

View File

@ -64,10 +64,9 @@ public:
void clearContactsList(); void clearContactsList();
void setTranslation(); void setTranslation();
void updateTrayIcon(); void updateTrayIcon();
Q_INVOKABLE QMessageBox::StandardButton showWarningMsgBox(const QString& title, const QString& msg, Q_INVOKABLE void showWarningMsgBox(const QString& title, const QString& msg);
QMessageBox::StandardButtons buttonss = QMessageBox::Ok);
Q_INVOKABLE void setEnabledThreadsafe(bool enabled); Q_INVOKABLE void setEnabledThreadsafe(bool enabled);
Q_INVOKABLE bool askMsgboxQuestion(const QString& title, const QString& msg); Q_INVOKABLE bool askQuestion(const QString& title, const QString& msg, bool warning = true);
Q_INVOKABLE QString passwordDialog(const QString& cancel, const QString& body); Q_INVOKABLE QString passwordDialog(const QString& cancel, const QString& body);
// hooray for threading hacks // hooray for threading hacks
~Widget(); ~Widget();