This repository has been archived by the owner on Jun 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added IPv6 option with IPv4 fallback
- Loading branch information
Showing
13 changed files
with
271 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
Copyright (C) 2014 by Maxim Biro <nurupo.contributions@gmail.com> | ||
This file is part of Tox Qt GUI. | ||
This program is free 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 "informationiconlabel.hpp" | ||
|
||
#include <QPainter> | ||
|
||
InformationIconLabel::InformationIconLabel(QWidget *parent) : | ||
QLabel(parent) | ||
{ | ||
QImage image(":/icons/information.png"); | ||
|
||
// set alpha to 175 | ||
QPainter p; | ||
p.begin(&image); | ||
p.setCompositionMode(QPainter::CompositionMode_DestinationIn); | ||
p.fillRect(image.rect(), QColor(0, 0, 0, 175)); | ||
p.end(); | ||
|
||
setPixmap(QPixmap::fromImage(image)); | ||
setFixedSize(16, 16); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
Copyright (C) 2014 by Maxim Biro <nurupo.contributions@gmail.com> | ||
This file is part of Tox Qt GUI. | ||
This program is free 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 INFORMATIONICONLABEL_HPP | ||
#define INFORMATIONICONLABEL_HPP | ||
|
||
#include <QLabel> | ||
|
||
class InformationIconLabel : public QLabel | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit InformationIconLabel(QWidget *parent = 0); | ||
|
||
}; | ||
|
||
#endif // INFORMATIONICONLABEL_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
Copyright (C) 2014 by Maxim Biro <nurupo.contributions@gmail.com> | ||
This file is part of Tox Qt GUI. | ||
This program is free 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 "networksettingspage.hpp" | ||
|
||
#include "informationiconlabel.hpp" | ||
#include "settings.hpp" | ||
|
||
#include <QCheckBox> | ||
#include <QGroupBox> | ||
#include <QVBoxLayout> | ||
|
||
NetworkSettingsPage::NetworkSettingsPage(QWidget *parent) : | ||
AbstractSettingsPage(parent) | ||
{ | ||
} | ||
|
||
void NetworkSettingsPage::buildGui() | ||
{ | ||
QVBoxLayout *layout = new QVBoxLayout(this); | ||
|
||
QGroupBox *networkGroup = buildNetworkGroup(); | ||
|
||
layout->addWidget(networkGroup); | ||
layout->addStretch(0); | ||
} | ||
|
||
QGroupBox* NetworkSettingsPage::buildNetworkGroup() | ||
{ | ||
QGroupBox *group = new QGroupBox("Network", this); | ||
QVBoxLayout *layout = new QVBoxLayout(group); | ||
|
||
enableIPv6CheckBox = new QCheckBox("Use IPv6", group); | ||
|
||
InformationIconLabel *IPv6InfoIcon = new InformationIconLabel(group); | ||
IPv6InfoIcon->setToolTip("Change requires client restart in order to take place"); | ||
|
||
enableIPv4FallbackCheckBox = new QCheckBox("Fallback to IPv4", group); | ||
|
||
connect(enableIPv6CheckBox, &QCheckBox::stateChanged, this, &NetworkSettingsPage::IPv6CheckBoxStateChanged); | ||
|
||
QHBoxLayout *IPv6Layout = new QHBoxLayout(); | ||
IPv6Layout->setSpacing(0); | ||
|
||
IPv6Layout->addWidget(enableIPv6CheckBox); | ||
IPv6Layout->addWidget(IPv6InfoIcon, 999, Qt::AlignHCenter | Qt::AlignLeft); | ||
|
||
layout->addLayout(IPv6Layout); | ||
layout->addWidget(enableIPv4FallbackCheckBox); | ||
|
||
return group; | ||
} | ||
|
||
void NetworkSettingsPage::setGui() | ||
{ | ||
const Settings& settings = Settings::getInstance(); | ||
enableIPv6CheckBox->setChecked(settings.isIPv6Enabled()); | ||
enableIPv4FallbackCheckBox->setChecked(settings.isIPv4FallbackEnabled()); | ||
IPv6CheckBoxStateChanged(enableIPv6CheckBox->isChecked() ? Qt::Checked : Qt::Unchecked); | ||
} | ||
|
||
void NetworkSettingsPage::applyChanges() | ||
{ | ||
Settings& settings = Settings::getInstance(); | ||
settings.setIPv6Enabled(enableIPv6CheckBox->isChecked()); | ||
settings.setIPv4FallbackEnabled(enableIPv4FallbackCheckBox->isChecked()); | ||
} | ||
|
||
void NetworkSettingsPage::IPv6CheckBoxStateChanged(int state) { | ||
enableIPv4FallbackCheckBox->setEnabled(state == Qt::Checked); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
Copyright (C) 2014 by Maxim Biro <nurupo.contributions@gmail.com> | ||
This file is part of Tox Qt GUI. | ||
This program is free 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 NETWORKSETTINGSPAGE_HPP | ||
#define NETWORKSETTINGSPAGE_HPP | ||
|
||
#include "abstractsettingspage.hpp" | ||
|
||
class QGroupBox; | ||
class QCheckBox; | ||
|
||
class NetworkSettingsPage : public AbstractSettingsPage | ||
{ | ||
public: | ||
NetworkSettingsPage(QWidget *parent); | ||
|
||
void applyChanges(); | ||
void buildGui(); | ||
void setGui(); | ||
|
||
private: | ||
QGroupBox *buildNetworkGroup(); | ||
|
||
QCheckBox *enableIPv6CheckBox; | ||
QCheckBox *enableIPv4FallbackCheckBox; | ||
|
||
private slots: | ||
void IPv6CheckBoxStateChanged(int state); | ||
}; | ||
|
||
#endif // NETWORKSETTINGSPAGE_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.