mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #433 from dubslow/master
fix #431, fix export cancels, and more debug prints
This commit is contained in:
commit
f2f572273c
|
@ -9,4 +9,4 @@ Exec=qtox
|
||||||
Icon=qtox
|
Icon=qtox
|
||||||
Categories=InstantMessaging;;AudioVideo;Network;
|
Categories=InstantMessaging;;AudioVideo;Network;
|
||||||
Terminal=false
|
Terminal=false
|
||||||
MimeType=x-scheme-handler/tox;
|
MimeType=x-scheme-handler/tox;application/x-tox;
|
||||||
|
|
11
src/core.cpp
11
src/core.cpp
|
@ -46,6 +46,8 @@ QList<ToxFile> Core::fileRecvQueue;
|
||||||
Core::Core(Camera* cam, QThread *coreThread, QString loadPath) :
|
Core::Core(Camera* cam, QThread *coreThread, QString loadPath) :
|
||||||
tox(nullptr), camera(cam), loadPath(loadPath)
|
tox(nullptr), camera(cam), loadPath(loadPath)
|
||||||
{
|
{
|
||||||
|
qDebug() << "Core: loading Tox from" << loadPath;
|
||||||
|
|
||||||
videobuf = new uint8_t[videobufsize];
|
videobuf = new uint8_t[videobufsize];
|
||||||
videoBusyness=0;
|
videoBusyness=0;
|
||||||
|
|
||||||
|
@ -583,7 +585,7 @@ void Core::onFileControlCallback(Tox* tox, int32_t friendnumber, uint8_t receive
|
||||||
|
|
||||||
uint64_t resumePos = *reinterpret_cast<const uint64_t*>(data);
|
uint64_t resumePos = *reinterpret_cast<const uint64_t*>(data);
|
||||||
|
|
||||||
if (resumePos >= file->filesize)
|
if (resumePos >= (unsigned)file->filesize)
|
||||||
{
|
{
|
||||||
qWarning() << "Core::onFileControlCallback: invalid resume position";
|
qWarning() << "Core::onFileControlCallback: invalid resume position";
|
||||||
tox_file_send_control(tox, file->friendId, 0, file->fileNum, TOX_FILECONTROL_KILL, nullptr, 0); // don't sure about it
|
tox_file_send_control(tox, file->friendId, 0, file->fileNum, TOX_FILECONTROL_KILL, nullptr, 0); // don't sure about it
|
||||||
|
@ -1184,6 +1186,13 @@ void Core::saveConfiguration(const QString& path)
|
||||||
|
|
||||||
void Core::switchConfiguration(QString profile)
|
void Core::switchConfiguration(QString profile)
|
||||||
{
|
{
|
||||||
|
if (profile.isEmpty())
|
||||||
|
{
|
||||||
|
qWarning() << "Core: got null profile to switch to, not switching";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
qDebug() << "Core: switching from" << Settings::getInstance().getCurrentProfile() << "to" << profile;
|
||||||
saveConfiguration();
|
saveConfiguration();
|
||||||
|
|
||||||
toxTimer->stop();
|
toxTimer->stop();
|
||||||
|
|
|
@ -34,7 +34,6 @@ Camera::Camera()
|
||||||
|
|
||||||
connect(workerThread, &QThread::started, worker, &CameraWorker::onStart);
|
connect(workerThread, &QThread::started, worker, &CameraWorker::onStart);
|
||||||
connect(workerThread, &QThread::finished, worker, &CameraWorker::deleteLater);
|
connect(workerThread, &QThread::finished, worker, &CameraWorker::deleteLater);
|
||||||
connect(workerThread, &QThread::deleteLater, worker, &CameraWorker::deleteLater);
|
|
||||||
connect(worker, &CameraWorker::started, this, &Camera::onWorkerStarted);
|
connect(worker, &CameraWorker::started, this, &Camera::onWorkerStarted);
|
||||||
connect(worker, &CameraWorker::newFrameAvailable, this, &Camera::onNewFrameAvailable);
|
connect(worker, &CameraWorker::newFrameAvailable, this, &Camera::onNewFrameAvailable);
|
||||||
connect(worker, &CameraWorker::resProbingFinished, this, &Camera::onResProbingFinished);
|
connect(worker, &CameraWorker::resProbingFinished, this, &Camera::onResProbingFinished);
|
||||||
|
|
|
@ -132,7 +132,8 @@ void IdentityForm::onExportClicked()
|
||||||
QString path = QFileDialog::getSaveFileName(this, tr("Export profile", "save dialog title"),
|
QString path = QFileDialog::getSaveFileName(this, tr("Export profile", "save dialog title"),
|
||||||
QDir::home().filePath(current),
|
QDir::home().filePath(current),
|
||||||
tr("Tox save file (*.tox)", "save dialog filter"));
|
tr("Tox save file (*.tox)", "save dialog filter"));
|
||||||
QFile::copy(QDir(Settings::getSettingsDirPath()).filePath(current), path);
|
if (!path.isEmpty())
|
||||||
|
QFile::copy(QDir(Settings::getSettingsDirPath()).filePath(current), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdentityForm::onDeleteClicked()
|
void IdentityForm::onDeleteClicked()
|
||||||
|
@ -157,6 +158,8 @@ void IdentityForm::onDeleteClicked()
|
||||||
void IdentityForm::onImportClicked()
|
void IdentityForm::onImportClicked()
|
||||||
{
|
{
|
||||||
QString path = QFileDialog::getOpenFileName(this, tr("Import profile", "import dialog title"), QDir::homePath(), tr("Tox save file (*.tox)", "import dialog filter"));
|
QString path = QFileDialog::getOpenFileName(this, tr("Import profile", "import dialog title"), QDir::homePath(), tr("Tox save file (*.tox)", "import dialog filter"));
|
||||||
|
if (path.isEmpty())
|
||||||
|
return;
|
||||||
QFileInfo info(path);
|
QFileInfo info(path);
|
||||||
QString profile = info.completeBaseName();
|
QString profile = info.completeBaseName();
|
||||||
QString profilePath = QDir(Settings::getSettingsDirPath()).filePath(profile + Core::TOX_EXT);
|
QString profilePath = QDir(Settings::getSettingsDirPath()).filePath(profile + Core::TOX_EXT);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user