mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #284 from retuxx/config-new
"rebased" Settings Dialog
This commit is contained in:
commit
2aff9fde5c
5
core.cpp
5
core.cpp
@ -718,12 +718,11 @@ void Core::setUsername(const QString& username)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Core::getSelfId()
|
ToxID Core::getSelfId()
|
||||||
{
|
{
|
||||||
uint8_t friendAddress[TOX_FRIEND_ADDRESS_SIZE];
|
uint8_t friendAddress[TOX_FRIEND_ADDRESS_SIZE];
|
||||||
tox_get_address(tox, friendAddress);
|
tox_get_address(tox, friendAddress);
|
||||||
|
return ToxID::fromString(CFriendAddress::toString(friendAddress));
|
||||||
return CFriendAddress::toString(friendAddress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Core::getStatusMessage()
|
QString Core::getStatusMessage()
|
||||||
|
2
core.h
2
core.h
@ -49,7 +49,7 @@ public:
|
|||||||
|
|
||||||
QString getUsername();
|
QString getUsername();
|
||||||
QString getStatusMessage();
|
QString getStatusMessage();
|
||||||
QString getSelfId();
|
ToxID getSelfId();
|
||||||
|
|
||||||
void increaseVideoBusyness();
|
void increaseVideoBusyness();
|
||||||
void decreaseVideoBusyness();
|
void decreaseVideoBusyness();
|
||||||
|
@ -10,6 +10,32 @@ class QTimer;
|
|||||||
|
|
||||||
enum class Status : int {Online = 0, Away, Busy, Offline};
|
enum class Status : int {Online = 0, Away, Busy, Offline};
|
||||||
|
|
||||||
|
#define TOX_ID_PUBLIC_KEY_LENGTH 64
|
||||||
|
#define TOX_ID_NO_SPAM_LENGTH 8
|
||||||
|
#define TOX_ID_CHECKSUM_LENGTH 4
|
||||||
|
|
||||||
|
struct ToxID
|
||||||
|
{
|
||||||
|
QString publicKey;
|
||||||
|
QString noSpam;
|
||||||
|
QString checkSum;
|
||||||
|
|
||||||
|
QString toString() const
|
||||||
|
{
|
||||||
|
return publicKey + noSpam + checkSum;
|
||||||
|
}
|
||||||
|
|
||||||
|
ToxID static fromString(QString id)
|
||||||
|
{
|
||||||
|
ToxID toxID;
|
||||||
|
toxID.publicKey = id.left(TOX_ID_PUBLIC_KEY_LENGTH);
|
||||||
|
toxID.noSpam = id.mid(TOX_ID_PUBLIC_KEY_LENGTH, TOX_ID_NO_SPAM_LENGTH);
|
||||||
|
toxID.checkSum = id.right(TOX_ID_CHECKSUM_LENGTH);
|
||||||
|
return toxID;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
struct DhtServer
|
struct DhtServer
|
||||||
{
|
{
|
||||||
QString name;
|
QString name;
|
||||||
|
BIN
img/settings/av.png
Normal file
BIN
img/settings/av.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
BIN
img/settings/general.png
Normal file
BIN
img/settings/general.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
img/settings/identity.png
Normal file
BIN
img/settings/identity.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
BIN
img/settings/privacy.png
Normal file
BIN
img/settings/privacy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
8
qtox.pro
8
qtox.pro
@ -79,7 +79,6 @@ win32 {
|
|||||||
HEADERS += widget/form/addfriendform.h \
|
HEADERS += widget/form/addfriendform.h \
|
||||||
widget/form/chatform.h \
|
widget/form/chatform.h \
|
||||||
widget/form/groupchatform.h \
|
widget/form/groupchatform.h \
|
||||||
widget/form/settingsform.h \
|
|
||||||
widget/form/filesform.h \
|
widget/form/filesform.h \
|
||||||
widget/tool/chattextedit.h \
|
widget/tool/chattextedit.h \
|
||||||
widget/tool/friendrequestdialog.h \
|
widget/tool/friendrequestdialog.h \
|
||||||
@ -110,13 +109,13 @@ HEADERS += widget/form/addfriendform.h \
|
|||||||
filetransferinstance.h \
|
filetransferinstance.h \
|
||||||
corestructs.h \
|
corestructs.h \
|
||||||
coredefines.h \
|
coredefines.h \
|
||||||
coreav.h
|
coreav.h \
|
||||||
|
widget/settingsdialog.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
widget/form/addfriendform.cpp \
|
widget/form/addfriendform.cpp \
|
||||||
widget/form/chatform.cpp \
|
widget/form/chatform.cpp \
|
||||||
widget/form/groupchatform.cpp \
|
widget/form/groupchatform.cpp \
|
||||||
widget/form/settingsform.cpp \
|
|
||||||
widget/form/filesform.cpp \
|
widget/form/filesform.cpp \
|
||||||
widget/tool/chattextedit.cpp \
|
widget/tool/chattextedit.cpp \
|
||||||
widget/tool/friendrequestdialog.cpp \
|
widget/tool/friendrequestdialog.cpp \
|
||||||
@ -147,4 +146,5 @@ SOURCES += \
|
|||||||
widget/tool/chataction.cpp \
|
widget/tool/chataction.cpp \
|
||||||
widget/chatareawidget.cpp \
|
widget/chatareawidget.cpp \
|
||||||
filetransferinstance.cpp \
|
filetransferinstance.cpp \
|
||||||
corestructs.cpp
|
corestructs.cpp \
|
||||||
|
widget/settingsdialog.cpp
|
||||||
|
4
res.qrc
4
res.qrc
@ -135,5 +135,9 @@
|
|||||||
<file>ui/fileTransferInstance/emptyRGreenFileButton.png</file>
|
<file>ui/fileTransferInstance/emptyRGreenFileButton.png</file>
|
||||||
<file>ui/fileTransferInstance/emptyRRedFileButton.png</file>
|
<file>ui/fileTransferInstance/emptyRRedFileButton.png</file>
|
||||||
<file>audio/notification.pcm</file>
|
<file>audio/notification.pcm</file>
|
||||||
|
<file>img/settings/general.png</file>
|
||||||
|
<file>img/settings/identity.png</file>
|
||||||
|
<file>img/settings/privacy.png</file>
|
||||||
|
<file>img/settings/av.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -95,7 +95,7 @@ void AddFriendForm::onSendTriggered()
|
|||||||
if (id.isEmpty()) {
|
if (id.isEmpty()) {
|
||||||
showWarning(tr("Please fill in a valid Tox ID","Tox ID of the friend you're sending a friend request to"));
|
showWarning(tr("Please fill in a valid Tox ID","Tox ID of the friend you're sending a friend request to"));
|
||||||
} else if (isToxId(id)) {
|
} else if (isToxId(id)) {
|
||||||
if (id.toUpper() == Core::getInstance()->getSelfId().toUpper())
|
if (id.toUpper() == Core::getInstance()->getSelfId().toString().toUpper())
|
||||||
showWarning(tr("You can't add yourself as a friend !","When trying to add your own Tox ID as friend"));
|
showWarning(tr("You can't add yourself as a friend !","When trying to add your own Tox ID as friend"));
|
||||||
else
|
else
|
||||||
emit friendRequested(id, getMessage());
|
emit friendRequested(id, getMessage());
|
||||||
|
@ -1,142 +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 "settingsform.h"
|
|
||||||
#include "widget/widget.h"
|
|
||||||
#include "settings.h"
|
|
||||||
#include "smileypack.h"
|
|
||||||
#include "ui_mainwindow.h"
|
|
||||||
#include <QFont>
|
|
||||||
#include <QClipboard>
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QDir>
|
|
||||||
|
|
||||||
SettingsForm::SettingsForm()
|
|
||||||
: QObject()
|
|
||||||
{
|
|
||||||
main = new QWidget(), head = new QWidget();
|
|
||||||
QFont bold, small;
|
|
||||||
bold.setBold(true);
|
|
||||||
small.setPixelSize(13);
|
|
||||||
small.setKerning(false);
|
|
||||||
headLabel.setText(tr("User Settings","\"Headline\" of the window"));
|
|
||||||
headLabel.setFont(bold);
|
|
||||||
|
|
||||||
nameLabel.setText(tr("Name","Username/nick"));
|
|
||||||
statusTextLabel.setText(tr("Status","Status message"));
|
|
||||||
idLabel.setText("Tox ID " + tr("(click here to copy)", "Click on this text to copy TID to clipboard"));
|
|
||||||
id.setFont(small);
|
|
||||||
id.setTextInteractionFlags(Qt::TextSelectableByMouse);
|
|
||||||
id.setReadOnly(true);
|
|
||||||
id.setFrameStyle(QFrame::NoFrame);
|
|
||||||
id.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
||||||
id.setFixedHeight(id.document()->size().height()*2);
|
|
||||||
|
|
||||||
videoTest.setText(tr("Test video","Text on a button to test the video/webcam"));
|
|
||||||
enableIPv6.setText(tr("Enable IPv6 (recommended)","Text on a checkbox to enable IPv6"));
|
|
||||||
enableIPv6.setChecked(Settings::getInstance().getEnableIPv6());
|
|
||||||
useTranslations.setText(tr("Use translations","Text on a checkbox to enable translations"));
|
|
||||||
useTranslations.setChecked(Settings::getInstance().getUseTranslations());
|
|
||||||
makeToxPortable.setText(tr("Make Tox portable","Text on a checkbox to make qTox a portable application"));
|
|
||||||
makeToxPortable.setChecked(Settings::getInstance().getMakeToxPortable());
|
|
||||||
makeToxPortable.setToolTip(tr("Save settings to the working directory instead of the usual conf dir","describes makeToxPortable checkbox"));
|
|
||||||
|
|
||||||
smileyPackLabel.setText(tr("Smiley Pack", "Text on smiley pack label"));
|
|
||||||
for (auto entry : SmileyPack::listSmileyPacks())
|
|
||||||
smileyPackBrowser.addItem(entry.first, entry.second);
|
|
||||||
smileyPackBrowser.setCurrentIndex(smileyPackBrowser.findData(Settings::getInstance().getSmileyPack()));
|
|
||||||
|
|
||||||
main->setLayout(&layout);
|
|
||||||
layout.addWidget(&nameLabel);
|
|
||||||
layout.addWidget(&name);
|
|
||||||
layout.addWidget(&statusTextLabel);
|
|
||||||
layout.addWidget(&statusText);
|
|
||||||
layout.addWidget(&idLabel);
|
|
||||||
layout.addWidget(&id);
|
|
||||||
layout.addWidget(&videoTest);
|
|
||||||
layout.addWidget(&enableIPv6);
|
|
||||||
layout.addWidget(&useTranslations);
|
|
||||||
layout.addWidget(&makeToxPortable);
|
|
||||||
layout.addWidget(&smileyPackLabel);
|
|
||||||
layout.addWidget(&smileyPackBrowser);
|
|
||||||
layout.addStretch();
|
|
||||||
|
|
||||||
head->setLayout(&headLayout);
|
|
||||||
headLayout.addWidget(&headLabel);
|
|
||||||
|
|
||||||
connect(&videoTest, SIGNAL(clicked()), this, SLOT(onTestVideoClicked()));
|
|
||||||
connect(&enableIPv6, SIGNAL(stateChanged(int)), this, SLOT(onEnableIPv6Updated()));
|
|
||||||
connect(&useTranslations, SIGNAL(stateChanged(int)), this, SLOT(onUseTranslationUpdated()));
|
|
||||||
connect(&makeToxPortable, SIGNAL(stateChanged(int)), this, SLOT(onMakeToxPortableUpdated()));
|
|
||||||
connect(&idLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
|
|
||||||
connect(&smileyPackBrowser, SIGNAL(currentIndexChanged(int)), this, SLOT(onSmileyBrowserIndexChanged(int)));
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingsForm::~SettingsForm()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsForm::setFriendAddress(const QString& friendAddress)
|
|
||||||
{
|
|
||||||
QString txt{friendAddress};
|
|
||||||
txt.insert(38,'\n');
|
|
||||||
id.setText(txt);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsForm::show(Ui::MainWindow &ui)
|
|
||||||
{
|
|
||||||
name.setText(ui.nameLabel->text());
|
|
||||||
statusText.setText(ui.statusLabel->text());
|
|
||||||
ui.mainContent->layout()->addWidget(main);
|
|
||||||
ui.mainHead->layout()->addWidget(head);
|
|
||||||
main->show();
|
|
||||||
head->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsForm::onTestVideoClicked()
|
|
||||||
{
|
|
||||||
Widget::getInstance()->showTestCamview();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsForm::onEnableIPv6Updated()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setEnableIPv6(enableIPv6.isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsForm::copyIdClicked()
|
|
||||||
{
|
|
||||||
id.selectAll();
|
|
||||||
QString txt = id.toPlainText();
|
|
||||||
txt.replace('\n',"");
|
|
||||||
QApplication::clipboard()->setText(txt);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsForm::onUseTranslationUpdated()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setUseTranslations(useTranslations.isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsForm::onMakeToxPortableUpdated()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setMakeToxPortable(makeToxPortable.isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsForm::onSmileyBrowserIndexChanged(int index)
|
|
||||||
{
|
|
||||||
QString filename = smileyPackBrowser.itemData(index).toString();
|
|
||||||
Settings::getInstance().setSmileyPack(filename);
|
|
||||||
}
|
|
@ -1,67 +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 SETTINGSFORM_H
|
|
||||||
#define SETTINGSFORM_H
|
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QTextEdit>
|
|
||||||
#include <QComboBox>
|
|
||||||
|
|
||||||
#include "widget/croppinglabel.h"
|
|
||||||
|
|
||||||
namespace Ui {class MainWindow;}
|
|
||||||
class QString;
|
|
||||||
|
|
||||||
class SettingsForm : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
SettingsForm();
|
|
||||||
~SettingsForm();
|
|
||||||
|
|
||||||
void show(Ui::MainWindow &ui);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void setFriendAddress(const QString& friendAddress);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void onTestVideoClicked();
|
|
||||||
void onEnableIPv6Updated();
|
|
||||||
void onUseTranslationUpdated();
|
|
||||||
void onMakeToxPortableUpdated();
|
|
||||||
void onSmileyBrowserIndexChanged(int index);
|
|
||||||
void copyIdClicked();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QLabel headLabel, nameLabel, statusTextLabel, smileyPackLabel;
|
|
||||||
QTextEdit id;
|
|
||||||
CroppingLabel idLabel;
|
|
||||||
QPushButton videoTest;
|
|
||||||
QCheckBox enableIPv6, useTranslations, makeToxPortable;
|
|
||||||
QVBoxLayout layout, headLayout;
|
|
||||||
QWidget *main, *head;
|
|
||||||
QComboBox smileyPackBrowser;
|
|
||||||
public:
|
|
||||||
QLineEdit name, statusText;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // SETTINGSFORM_H
|
|
355
widget/settingsdialog.cpp
Normal file
355
widget/settingsdialog.cpp
Normal file
@ -0,0 +1,355 @@
|
|||||||
|
#include "settingsdialog.h"
|
||||||
|
#include "settings.h"
|
||||||
|
#include "widget.h"
|
||||||
|
#include "camera.h"
|
||||||
|
#include "selfcamview.h"
|
||||||
|
#include "core.h"
|
||||||
|
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QListWidgetItem>
|
||||||
|
#include <QStackedWidget>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QLineEdit>
|
||||||
|
|
||||||
|
|
||||||
|
// =======================================
|
||||||
|
// settings pages
|
||||||
|
//========================================
|
||||||
|
class GeneralPage : public QWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GeneralPage(QWidget *parent = 0) :
|
||||||
|
QWidget(parent)
|
||||||
|
{
|
||||||
|
QGroupBox *group = new QGroupBox(tr("General Settings"), this);
|
||||||
|
|
||||||
|
enableIPv6 = new QCheckBox(this);
|
||||||
|
enableIPv6->setText(tr("Enable IPv6 (recommended)","Text on a checkbox to enable IPv6"));
|
||||||
|
useTranslations = new QCheckBox(this);
|
||||||
|
useTranslations->setText(tr("Use translations","Text on a checkbox to enable translations"));
|
||||||
|
makeToxPortable = new QCheckBox(this);
|
||||||
|
makeToxPortable->setText(tr("Make Tox portable","Text on a checkbox to make qTox a portable application"));
|
||||||
|
makeToxPortable->setToolTip(tr("Save settings to the working directory instead of the usual conf dir","describes makeToxPortable checkbox"));
|
||||||
|
|
||||||
|
QVBoxLayout *vLayout = new QVBoxLayout();
|
||||||
|
vLayout->addWidget(enableIPv6);
|
||||||
|
vLayout->addWidget(useTranslations);
|
||||||
|
vLayout->addWidget(makeToxPortable);
|
||||||
|
group->setLayout(vLayout);
|
||||||
|
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout();
|
||||||
|
mainLayout->addWidget(group);
|
||||||
|
mainLayout->addStretch(1);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
QCheckBox* enableIPv6;
|
||||||
|
QCheckBox* useTranslations;
|
||||||
|
QCheckBox* makeToxPortable;
|
||||||
|
};
|
||||||
|
|
||||||
|
class IdentityPage : public QWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IdentityPage(QWidget* parent = 0) :
|
||||||
|
QWidget(parent)
|
||||||
|
{
|
||||||
|
// public
|
||||||
|
QGroupBox *publicGroup = new QGroupBox(tr("Public Information"), this);
|
||||||
|
QLabel* userNameLabel = new QLabel(tr("Name","Username/nick"), this);
|
||||||
|
userName = new QLineEdit(this);
|
||||||
|
QLabel* statusMessageLabel = new QLabel(tr("Status","Status message"), this);
|
||||||
|
statusMessage = new QLineEdit(this);
|
||||||
|
QVBoxLayout *vLayout = new QVBoxLayout();
|
||||||
|
vLayout->addWidget(userNameLabel);
|
||||||
|
vLayout->addWidget(userName);
|
||||||
|
vLayout->addWidget(statusMessageLabel);
|
||||||
|
vLayout->addWidget(statusMessage);
|
||||||
|
publicGroup->setLayout(vLayout);
|
||||||
|
|
||||||
|
// tox
|
||||||
|
QGroupBox* toxGroup = new QGroupBox(tr("Tox ID"), this);
|
||||||
|
QLabel* toxIdLabel = new QLabel(tr("Your Tox ID"), this);
|
||||||
|
toxID = new QLineEdit(this);
|
||||||
|
toxID->setReadOnly(true);
|
||||||
|
QVBoxLayout* toxLayout = new QVBoxLayout();
|
||||||
|
toxLayout->addWidget(toxIdLabel);
|
||||||
|
toxLayout->addWidget(toxID);
|
||||||
|
toxGroup->setLayout(toxLayout);
|
||||||
|
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout();
|
||||||
|
mainLayout->setSpacing(30);
|
||||||
|
mainLayout->addWidget(publicGroup);
|
||||||
|
mainLayout->addWidget(toxGroup);
|
||||||
|
mainLayout->addStretch(1);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineEdit* userName;
|
||||||
|
QLineEdit* statusMessage;
|
||||||
|
QLineEdit* toxID;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PrivacyPage : public QWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PrivacyPage(QWidget* parent = 0) :
|
||||||
|
QWidget(parent)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
class AVPage : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
AVPage(SettingsDialog* parent = 0) :
|
||||||
|
QWidget(parent)
|
||||||
|
{
|
||||||
|
QGroupBox *group = new QGroupBox(tr("Video Settings"), this);
|
||||||
|
|
||||||
|
camView = new SelfCamView(parent->getWidget()->getCamera());
|
||||||
|
camView->hide(); // hide by default
|
||||||
|
testVideo = new QPushButton("enable video");
|
||||||
|
connect(testVideo, SIGNAL(clicked()), this, SLOT(onTestVideoPressed()));
|
||||||
|
|
||||||
|
QVBoxLayout *vLayout = new QVBoxLayout();
|
||||||
|
vLayout->addWidget(testVideo);
|
||||||
|
vLayout->addWidget(camView);
|
||||||
|
group->setLayout(vLayout);
|
||||||
|
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout();
|
||||||
|
mainLayout->addWidget(group);
|
||||||
|
mainLayout->addStretch(1);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
~AVPage()
|
||||||
|
{
|
||||||
|
delete camView;
|
||||||
|
}
|
||||||
|
|
||||||
|
void showTestVideo()
|
||||||
|
{
|
||||||
|
testVideo->setText("disable video");
|
||||||
|
camView->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void closeTestVideo()
|
||||||
|
{
|
||||||
|
testVideo->setText("enable video");
|
||||||
|
camView->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton* testVideo;
|
||||||
|
SelfCamView* camView;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void onTestVideoPressed()
|
||||||
|
{
|
||||||
|
if (camView->isVisible()) {
|
||||||
|
closeTestVideo();
|
||||||
|
} else {
|
||||||
|
showTestVideo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// allows Q_OBJECT macro inside cpp
|
||||||
|
#include "settingsdialog.moc"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// =======================================
|
||||||
|
// settings dialog
|
||||||
|
//========================================
|
||||||
|
SettingsDialog::SettingsDialog(Widget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
widget(parent)
|
||||||
|
{
|
||||||
|
createPages();
|
||||||
|
createButtons();
|
||||||
|
createConnections();
|
||||||
|
createLayout();
|
||||||
|
setWindowTitle(tr("Settings Dialog"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::createPages()
|
||||||
|
{
|
||||||
|
generalPage = new GeneralPage(this);
|
||||||
|
identityPage = new IdentityPage(this);
|
||||||
|
privacyPage = new PrivacyPage(this);
|
||||||
|
avPage = new AVPage(this);
|
||||||
|
|
||||||
|
contentsWidget = new QListWidget;
|
||||||
|
contentsWidget->setViewMode(QListView::IconMode);
|
||||||
|
contentsWidget->setIconSize(QSize(100, 73));
|
||||||
|
contentsWidget->setMovement(QListView::Static);
|
||||||
|
contentsWidget->setMaximumWidth(110);
|
||||||
|
contentsWidget->setMinimumWidth(110);
|
||||||
|
contentsWidget->setSpacing(0);
|
||||||
|
contentsWidget->setFlow(QListView::TopToBottom);
|
||||||
|
|
||||||
|
pagesWidget = new QStackedWidget;
|
||||||
|
pagesWidget->addWidget(generalPage);
|
||||||
|
pagesWidget->addWidget(identityPage);
|
||||||
|
pagesWidget->addWidget(privacyPage);
|
||||||
|
pagesWidget->addWidget(avPage);
|
||||||
|
|
||||||
|
QListWidgetItem *generalButton = new QListWidgetItem(contentsWidget);
|
||||||
|
generalButton->setIcon(QIcon(":/img/settings/general.png"));
|
||||||
|
generalButton->setText(tr("General"));
|
||||||
|
generalButton->setTextAlignment(Qt::AlignHCenter);
|
||||||
|
generalButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
|
QListWidgetItem *identity = new QListWidgetItem(contentsWidget);
|
||||||
|
identity->setIcon(QIcon(":/img/settings/identity.png"));
|
||||||
|
identity->setText(tr("Identity"));
|
||||||
|
identity->setTextAlignment(Qt::AlignHCenter);
|
||||||
|
identity->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
|
QListWidgetItem *privacy = new QListWidgetItem(contentsWidget);
|
||||||
|
privacy->setIcon(QIcon(":/img/settings/privacy.png"));
|
||||||
|
privacy->setText(tr("Privacy"));
|
||||||
|
privacy->setTextAlignment(Qt::AlignHCenter);
|
||||||
|
privacy->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
|
QListWidgetItem *av = new QListWidgetItem(contentsWidget);
|
||||||
|
av->setIcon(QIcon(":/img/settings/av.png"));
|
||||||
|
av->setText(tr("Audio/Video"));
|
||||||
|
av->setTextAlignment(Qt::AlignHCenter);
|
||||||
|
av->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
|
contentsWidget->setCurrentRow(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::createButtons()
|
||||||
|
{
|
||||||
|
okButton = new QPushButton(tr("Ok"), this);
|
||||||
|
cancelButton = new QPushButton(tr("Cancel"), this);
|
||||||
|
applyButton = new QPushButton(tr("Apply"), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::createConnections()
|
||||||
|
{
|
||||||
|
connect(okButton, SIGNAL(clicked()), this, SLOT(okPressed()));
|
||||||
|
connect(cancelButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||||
|
connect(applyButton, SIGNAL(clicked()), this, SLOT(applyPressed()));
|
||||||
|
connect(
|
||||||
|
contentsWidget,
|
||||||
|
SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||||
|
this,
|
||||||
|
SLOT(changePage(QListWidgetItem*,QListWidgetItem*))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::createLayout()
|
||||||
|
{
|
||||||
|
setMinimumSize(800, 500);
|
||||||
|
|
||||||
|
QHBoxLayout *buttonsLayout = new QHBoxLayout();
|
||||||
|
buttonsLayout->addStretch(1);
|
||||||
|
buttonsLayout->addWidget(okButton);
|
||||||
|
buttonsLayout->addWidget(cancelButton);
|
||||||
|
buttonsLayout->addWidget(applyButton);
|
||||||
|
|
||||||
|
QHBoxLayout *hLayout = new QHBoxLayout();
|
||||||
|
hLayout->addWidget(contentsWidget);
|
||||||
|
hLayout->addWidget(pagesWidget, 1);
|
||||||
|
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout();
|
||||||
|
mainLayout->addLayout(hLayout);
|
||||||
|
mainLayout->addLayout(buttonsLayout);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
|
||||||
|
{
|
||||||
|
if (!current) {
|
||||||
|
current = previous;
|
||||||
|
}
|
||||||
|
pagesWidget->setCurrentIndex(contentsWidget->row(current));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::okPressed()
|
||||||
|
{
|
||||||
|
writeConfig();
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::cancelPressed()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::applyPressed()
|
||||||
|
{
|
||||||
|
writeConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::readConfig()
|
||||||
|
{
|
||||||
|
Settings& settings = Settings::getInstance();
|
||||||
|
Core* core = widget->getCore();
|
||||||
|
|
||||||
|
generalPage->enableIPv6->setChecked(settings.getEnableIPv6());
|
||||||
|
generalPage->useTranslations->setChecked(settings.getUseTranslations());
|
||||||
|
generalPage->makeToxPortable->setChecked(settings.getMakeToxPortable());
|
||||||
|
|
||||||
|
identityPage->userName->setText(core->getUsername());
|
||||||
|
identityPage->statusMessage->setText(core->getStatusMessage());
|
||||||
|
identityPage->toxID->setText(core->getSelfId().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::writeConfig()
|
||||||
|
{
|
||||||
|
Settings& settings = Settings::getInstance();
|
||||||
|
Core* core = widget->getCore();
|
||||||
|
|
||||||
|
|
||||||
|
// only save settings if something changed
|
||||||
|
bool saveSettings = false;
|
||||||
|
if (settings.getEnableIPv6() != generalPage->enableIPv6->isChecked()) {
|
||||||
|
settings.setEnableIPv6(generalPage->enableIPv6->isChecked());
|
||||||
|
saveSettings = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.getUseTranslations() != generalPage->useTranslations->isChecked()) {
|
||||||
|
settings.setUseTranslations(generalPage->useTranslations->isChecked());
|
||||||
|
saveSettings = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.getMakeToxPortable() != generalPage->makeToxPortable->isChecked()) {
|
||||||
|
settings.setMakeToxPortable(generalPage->makeToxPortable->isChecked());
|
||||||
|
saveSettings = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (saveSettings) {
|
||||||
|
settings.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// changing core settings will automatically save them
|
||||||
|
QString userName = identityPage->userName->text();
|
||||||
|
if (core->getUsername() != userName) {
|
||||||
|
core->setUsername(userName);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString statusMessage = identityPage->statusMessage->text();
|
||||||
|
if (core->getStatusMessage() != statusMessage) {
|
||||||
|
core->setStatusMessage(statusMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget* SettingsDialog::getWidget()
|
||||||
|
{
|
||||||
|
return widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::closeEvent(QCloseEvent* e){
|
||||||
|
avPage->closeTestVideo();
|
||||||
|
QDialog::closeEvent(e);
|
||||||
|
}
|
64
widget/settingsdialog.h
Normal file
64
widget/settingsdialog.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#ifndef SETTINGSDIALOG_H
|
||||||
|
#define SETTINGSDIALOG_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
class Widget;
|
||||||
|
class SelfCamView;
|
||||||
|
class Camera;
|
||||||
|
class GeneralPage;
|
||||||
|
class IdentityPage;
|
||||||
|
class PrivacyPage;
|
||||||
|
class AVPage;
|
||||||
|
|
||||||
|
class QListWidget;
|
||||||
|
class QListWidgetItem;
|
||||||
|
class QStackedWidget;
|
||||||
|
class QPushButton;
|
||||||
|
class QCheckBox;
|
||||||
|
class QLineEdit;
|
||||||
|
|
||||||
|
// =======================================
|
||||||
|
// settings dialog
|
||||||
|
//========================================
|
||||||
|
class SettingsDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit SettingsDialog(Widget *parent);
|
||||||
|
|
||||||
|
void readConfig();
|
||||||
|
void writeConfig();
|
||||||
|
Widget* getWidget();
|
||||||
|
void closeEvent(QCloseEvent *);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
|
void okPressed();
|
||||||
|
void cancelPressed();
|
||||||
|
void applyPressed();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void createPages();
|
||||||
|
void createButtons();
|
||||||
|
void createConnections();
|
||||||
|
void createLayout();
|
||||||
|
|
||||||
|
Widget* widget;
|
||||||
|
|
||||||
|
// pages
|
||||||
|
GeneralPage* generalPage;
|
||||||
|
IdentityPage* identityPage;
|
||||||
|
PrivacyPage* privacyPage;
|
||||||
|
AVPage* avPage;
|
||||||
|
QListWidget* contentsWidget;
|
||||||
|
QStackedWidget* pagesWidget;
|
||||||
|
|
||||||
|
// buttons
|
||||||
|
QPushButton* okButton;
|
||||||
|
QPushButton* cancelButton;
|
||||||
|
QPushButton* applyButton;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SETTINGSDIALOG_H
|
@ -31,6 +31,7 @@
|
|||||||
#include "widget/friendlistwidget.h"
|
#include "widget/friendlistwidget.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
#include "widget/form/chatform.h"
|
#include "widget/form/chatform.h"
|
||||||
|
#include "widget/settingsdialog.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@ -155,7 +156,7 @@ Widget::Widget(QWidget *parent)
|
|||||||
ui->statusButton->style()->polish(ui->statusButton);
|
ui->statusButton->style()->polish(ui->statusButton);
|
||||||
|
|
||||||
camera = new Camera;
|
camera = new Camera;
|
||||||
camview = new SelfCamView(camera);
|
settingsDialog = new SettingsDialog(this);
|
||||||
|
|
||||||
// Disable some widgets until we're connected to the DHT
|
// Disable some widgets until we're connected to the DHT
|
||||||
ui->statusButton->setEnabled(false);
|
ui->statusButton->setEnabled(false);
|
||||||
@ -179,7 +180,6 @@ Widget::Widget(QWidget *parent)
|
|||||||
connect(core, &Core::statusSet, this, &Widget::onStatusSet);
|
connect(core, &Core::statusSet, this, &Widget::onStatusSet);
|
||||||
connect(core, &Core::usernameSet, this, &Widget::setUsername);
|
connect(core, &Core::usernameSet, this, &Widget::setUsername);
|
||||||
connect(core, &Core::statusMessageSet, this, &Widget::setStatusMessage);
|
connect(core, &Core::statusMessageSet, this, &Widget::setStatusMessage);
|
||||||
connect(core, &Core::friendAddressGenerated, &settingsForm, &SettingsForm::setFriendAddress);
|
|
||||||
connect(core, SIGNAL(fileDownloadFinished(const QString&)), &filesForm, SLOT(onFileDownloadComplete(const QString&)));
|
connect(core, SIGNAL(fileDownloadFinished(const QString&)), &filesForm, SLOT(onFileDownloadComplete(const QString&)));
|
||||||
connect(core, SIGNAL(fileUploadFinished(const QString&)), &filesForm, SLOT(onFileUploadComplete(const QString&)));
|
connect(core, SIGNAL(fileUploadFinished(const QString&)), &filesForm, SLOT(onFileUploadComplete(const QString&)));
|
||||||
connect(core, &Core::friendAdded, this, &Widget::addFriend);
|
connect(core, &Core::friendAdded, this, &Widget::addFriend);
|
||||||
@ -210,8 +210,6 @@ Widget::Widget(QWidget *parent)
|
|||||||
connect(setStatusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline()));
|
connect(setStatusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline()));
|
||||||
connect(setStatusAway, SIGNAL(triggered()), this, SLOT(setStatusAway()));
|
connect(setStatusAway, SIGNAL(triggered()), this, SLOT(setStatusAway()));
|
||||||
connect(setStatusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy()));
|
connect(setStatusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy()));
|
||||||
connect(&settingsForm.name, SIGNAL(editingFinished()), this, SLOT(onUsernameChanged()));
|
|
||||||
connect(&settingsForm.statusText, SIGNAL(editingFinished()), this, SLOT(onStatusMessageChanged()));
|
|
||||||
connect(&friendForm, SIGNAL(friendRequested(QString,QString)), this, SIGNAL(friendRequested(QString,QString)));
|
connect(&friendForm, SIGNAL(friendRequested(QString,QString)), this, SIGNAL(friendRequested(QString,QString)));
|
||||||
|
|
||||||
coreThread->start();
|
coreThread->start();
|
||||||
@ -228,7 +226,6 @@ Widget::~Widget()
|
|||||||
if (!coreThread->isFinished())
|
if (!coreThread->isFinished())
|
||||||
coreThread->terminate();
|
coreThread->terminate();
|
||||||
delete core;
|
delete core;
|
||||||
delete camview;
|
|
||||||
|
|
||||||
hideMainForms();
|
hideMainForms();
|
||||||
|
|
||||||
@ -338,9 +335,8 @@ void Widget::onTransferClicked()
|
|||||||
|
|
||||||
void Widget::onSettingsClicked()
|
void Widget::onSettingsClicked()
|
||||||
{
|
{
|
||||||
hideMainForms();
|
settingsDialog->readConfig();
|
||||||
settingsForm.show(*ui);
|
settingsDialog->show();
|
||||||
activeChatroomWidget = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::hideMainForms()
|
void Widget::hideMainForms()
|
||||||
@ -357,20 +353,10 @@ void Widget::hideMainForms()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::onUsernameChanged()
|
|
||||||
{
|
|
||||||
const QString newUsername = settingsForm.name.text();
|
|
||||||
ui->nameLabel->setText(newUsername);
|
|
||||||
ui->nameLabel->setToolTip(newUsername); // for overlength names
|
|
||||||
settingsForm.name.setText(newUsername);
|
|
||||||
core->setUsername(newUsername);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::onUsernameChanged(const QString& newUsername, const QString& oldUsername)
|
void Widget::onUsernameChanged(const QString& newUsername, const QString& oldUsername)
|
||||||
{
|
{
|
||||||
ui->nameLabel->setText(oldUsername); // restore old username until Core tells us to set it
|
ui->nameLabel->setText(oldUsername); // restore old username until Core tells us to set it
|
||||||
ui->nameLabel->setToolTip(oldUsername); // for overlength names
|
ui->nameLabel->setToolTip(oldUsername); // for overlength names
|
||||||
settingsForm.name.setText(oldUsername);
|
|
||||||
core->setUsername(newUsername);
|
core->setUsername(newUsername);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,23 +364,12 @@ void Widget::setUsername(const QString& username)
|
|||||||
{
|
{
|
||||||
ui->nameLabel->setText(username);
|
ui->nameLabel->setText(username);
|
||||||
ui->nameLabel->setToolTip(username); // for overlength names
|
ui->nameLabel->setToolTip(username); // for overlength names
|
||||||
settingsForm.name.setText(username);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::onStatusMessageChanged()
|
|
||||||
{
|
|
||||||
const QString newStatusMessage = settingsForm.statusText.text();
|
|
||||||
ui->statusLabel->setText(newStatusMessage);
|
|
||||||
ui->statusLabel->setToolTip(newStatusMessage); // for overlength messsages
|
|
||||||
settingsForm.statusText.setText(newStatusMessage);
|
|
||||||
core->setStatusMessage(newStatusMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage)
|
void Widget::onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage)
|
||||||
{
|
{
|
||||||
ui->statusLabel->setText(oldStatusMessage); // restore old status message until Core tells us to set it
|
ui->statusLabel->setText(oldStatusMessage); // restore old status message until Core tells us to set it
|
||||||
ui->statusLabel->setToolTip(oldStatusMessage); // for overlength messsages
|
ui->statusLabel->setToolTip(oldStatusMessage); // for overlength messsages
|
||||||
settingsForm.statusText.setText(oldStatusMessage);
|
|
||||||
core->setStatusMessage(newStatusMessage);
|
core->setStatusMessage(newStatusMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,7 +377,6 @@ void Widget::setStatusMessage(const QString &statusMessage)
|
|||||||
{
|
{
|
||||||
ui->statusLabel->setText(statusMessage);
|
ui->statusLabel->setText(statusMessage);
|
||||||
ui->statusLabel->setToolTip(statusMessage); // for overlength messsages
|
ui->statusLabel->setToolTip(statusMessage); // for overlength messsages
|
||||||
settingsForm.statusText.setText(statusMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::addFriend(int friendId, const QString &userId)
|
void Widget::addFriend(int friendId, const QString &userId)
|
||||||
@ -677,11 +651,6 @@ Group *Widget::createGroup(int groupId)
|
|||||||
return newgroup;
|
return newgroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::showTestCamview()
|
|
||||||
{
|
|
||||||
camview->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::onEmptyGroupCreated(int groupId)
|
void Widget::onEmptyGroupCreated(int groupId)
|
||||||
{
|
{
|
||||||
createGroup(groupId);
|
createGroup(groupId);
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include "widget/form/addfriendform.h"
|
#include "widget/form/addfriendform.h"
|
||||||
#include "widget/form/settingsform.h"
|
|
||||||
#include "widget/form/filesform.h"
|
#include "widget/form/filesform.h"
|
||||||
#include "corestructs.h"
|
#include "corestructs.h"
|
||||||
|
|
||||||
@ -38,6 +37,7 @@ class QMenu;
|
|||||||
class Core;
|
class Core;
|
||||||
class Camera;
|
class Camera;
|
||||||
class FriendListWidget;
|
class FriendListWidget;
|
||||||
|
class SettingsDialog;
|
||||||
|
|
||||||
class Widget : public QMainWindow
|
class Widget : public QMainWindow
|
||||||
{
|
{
|
||||||
@ -54,7 +54,6 @@ public:
|
|||||||
QThread* getCoreThread();
|
QThread* getCoreThread();
|
||||||
Camera* getCamera();
|
Camera* getCamera();
|
||||||
static Widget* getInstance();
|
static Widget* getInstance();
|
||||||
void showTestCamview();
|
|
||||||
void newMessageAlert();
|
void newMessageAlert();
|
||||||
bool isFriendWidgetCurActiveWidget(Friend* f);
|
bool isFriendWidgetCurActiveWidget(Friend* f);
|
||||||
bool getIsWindowMinimized();
|
bool getIsWindowMinimized();
|
||||||
@ -83,8 +82,6 @@ private slots:
|
|||||||
void onFailedToStartCore();
|
void onFailedToStartCore();
|
||||||
void onUsernameChanged(const QString& newUsername, const QString& oldUsername);
|
void onUsernameChanged(const QString& newUsername, const QString& oldUsername);
|
||||||
void onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage);
|
void onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage);
|
||||||
void onUsernameChanged();
|
|
||||||
void onStatusMessageChanged();
|
|
||||||
void setUsername(const QString& username);
|
void setUsername(const QString& username);
|
||||||
void setStatusMessage(const QString &statusMessage);
|
void setStatusMessage(const QString &statusMessage);
|
||||||
void addFriend(int friendId, const QString& userId);
|
void addFriend(int friendId, const QString& userId);
|
||||||
@ -137,12 +134,11 @@ private:
|
|||||||
Core* core;
|
Core* core;
|
||||||
QThread* coreThread;
|
QThread* coreThread;
|
||||||
AddFriendForm friendForm;
|
AddFriendForm friendForm;
|
||||||
SettingsForm settingsForm;
|
|
||||||
FilesForm filesForm;
|
FilesForm filesForm;
|
||||||
|
SettingsDialog* settingsDialog;
|
||||||
static Widget* instance;
|
static Widget* instance;
|
||||||
GenericChatroomWidget* activeChatroomWidget;
|
GenericChatroomWidget* activeChatroomWidget;
|
||||||
FriendListWidget* contactListWidget;
|
FriendListWidget* contactListWidget;
|
||||||
SelfCamView* camview;
|
|
||||||
Camera* camera;
|
Camera* camera;
|
||||||
bool notify(QObject *receiver, QEvent *event);
|
bool notify(QObject *receiver, QEvent *event);
|
||||||
bool eventFilter(QObject *, QEvent *event);
|
bool eventFilter(QObject *, QEvent *event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user