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

initial new settings widget, subforms not started

also "filing" some files under misc
This commit is contained in:
dubslow 2014-09-13 03:32:24 -05:00 committed by Tux3 / Mlkj / !Lev.uXFMLA
parent 59869b4a87
commit e4e36dc946
21 changed files with 258 additions and 33 deletions

View File

@ -15,9 +15,9 @@
*/
#include "core.h"
#include "cdata.h"
#include "cstring.h"
#include "settings.h"
#include "misc/cdata.h"
#include "misc/cstring.h"
#include "misc/settings.h"
#include "widget/widget.h"
#include <tox/tox.h>

View File

@ -15,7 +15,7 @@
*/
#include "widget/widget.h"
#include "settings.h"
#include "misc/settings.h"
#include <QApplication>
#include <QFontDatabase>
#include <QTranslator>

View File

@ -81,6 +81,7 @@ win32 {
HEADERS += widget/form/addfriendform.h \
widget/form/chatform.h \
widget/form/groupchatform.h \
widget/form/settingswidget.h \
widget/form/filesform.h \
widget/tool/chattextedit.h \
widget/tool/friendrequestdialog.h \
@ -90,17 +91,17 @@ HEADERS += widget/form/addfriendform.h \
friend.h \
group.h \
grouplist.h \
settings.h \
misc/settings.h \
core.h \
friendlist.h \
cdata.h \
cstring.h \
misc/cdata.h \
misc/cstring.h \
widget/selfcamview.h \
widget/camera.h \
widget/netcamview.h \
smileypack.h \
misc/smileypack.h \
widget/emoticonswidget.h \
style.h \
misc/style.h \
widget/adjustingscrollarea.h \
widget/croppinglabel.h \
widget/friendlistwidget.h \
@ -111,13 +112,13 @@ HEADERS += widget/form/addfriendform.h \
filetransferinstance.h \
corestructs.h \
coredefines.h \
coreav.h \
widget/settingsdialog.h
coreav.h
SOURCES += \
widget/form/addfriendform.cpp \
widget/form/chatform.cpp \
widget/form/groupchatform.cpp \
widget/form/settingswidget.cpp \
widget/form/filesform.cpp \
widget/tool/chattextedit.cpp \
widget/tool/friendrequestdialog.cpp \
@ -130,15 +131,15 @@ SOURCES += \
group.cpp \
grouplist.cpp \
main.cpp \
settings.cpp \
cdata.cpp \
cstring.cpp \
misc/settings.cpp \
misc/cdata.cpp \
misc/cstring.cpp \
widget/selfcamview.cpp \
widget/camera.cpp \
widget/netcamview.cpp \
smileypack.cpp \
misc/smileypack.cpp \
widget/emoticonswidget.cpp \
style.cpp \
misc/style.cpp \
widget/adjustingscrollarea.cpp \
widget/croppinglabel.cpp \
widget/friendlistwidget.cpp \
@ -148,5 +149,4 @@ SOURCES += \
widget/tool/chataction.cpp \
widget/chatareawidget.cpp \
filetransferinstance.cpp \
corestructs.cpp \
widget/settingsdialog.cpp
corestructs.cpp

View File

@ -15,8 +15,8 @@
*/
#include "emoticonswidget.h"
#include "smileypack.h"
#include "style.h"
#include "misc/smileypack.h"
#include "misc/style.h"
#include <QPushButton>
#include <QRadioButton>

View File

@ -17,11 +17,11 @@
#include "genericchatform.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
#include "smileypack.h"
#include "misc/smileypack.h"
#include "widget/emoticonswidget.h"
#include "style.h"
#include "misc/style.h"
#include "widget/widget.h"
#include "settings.h"
#include "misc/settings.h"
#include "widget/tool/chataction.h"
#include "widget/chatareawidget.h"
#include "widget/tool/chattextedit.h"

View File

@ -0,0 +1,164 @@
/*
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 "settingswidget.h"
#include "widget/widget.h"
#include "ui_mainwindow.h"
SettingsWidget::SettingsWidget()
: QObject()
{
main = new QWidget();
// this crap is copied from ui_mainwindow.h... there's no easy way around
// just straight up copying it like this... oh well
// the layout/icons obviously need to be improved, but it's a working model,
// not a pretty one
QSizePolicy sizePolicy3(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
sizePolicy3.setHorizontalStretch(0);
sizePolicy3.setVerticalStretch(0);
head = new QWidget();
head->setObjectName(QStringLiteral("head"));
head->setEnabled(true);
sizePolicy3.setHeightForWidth(head->sizePolicy().hasHeightForWidth());
head->setSizePolicy(sizePolicy3);
QPalette palette5;
QBrush brush(QColor(255, 255, 255, 255));
brush.setStyle(Qt::SolidPattern);
QBrush brush1(QColor(28, 28, 28, 255));
brush1.setStyle(Qt::SolidPattern);
QBrush brush2(QColor(42, 42, 42, 255));
brush2.setStyle(Qt::SolidPattern);
QBrush brush3(QColor(35, 35, 35, 255));
brush3.setStyle(Qt::SolidPattern);
QBrush brush4(QColor(14, 14, 14, 255));
brush4.setStyle(Qt::SolidPattern);
QBrush brush5(QColor(18, 18, 18, 255));
brush5.setStyle(Qt::SolidPattern);
QBrush brush6(QColor(0, 0, 0, 255));
brush6.setStyle(Qt::SolidPattern);
QBrush brush7(QColor(255, 255, 220, 255));
brush7.setStyle(Qt::SolidPattern);
palette5.setBrush(QPalette::Active, QPalette::WindowText, brush);
palette5.setBrush(QPalette::Active, QPalette::Button, brush1);
palette5.setBrush(QPalette::Active, QPalette::Light, brush2);
palette5.setBrush(QPalette::Active, QPalette::Midlight, brush3);
palette5.setBrush(QPalette::Active, QPalette::Dark, brush4);
palette5.setBrush(QPalette::Active, QPalette::Mid, brush5);
palette5.setBrush(QPalette::Active, QPalette::Text, brush);
palette5.setBrush(QPalette::Active, QPalette::BrightText, brush);
palette5.setBrush(QPalette::Active, QPalette::ButtonText, brush);
palette5.setBrush(QPalette::Active, QPalette::Base, brush6);
palette5.setBrush(QPalette::Active, QPalette::Window, brush1);
palette5.setBrush(QPalette::Active, QPalette::Shadow, brush6);
palette5.setBrush(QPalette::Active, QPalette::AlternateBase, brush4);
palette5.setBrush(QPalette::Active, QPalette::ToolTipBase, brush7);
palette5.setBrush(QPalette::Active, QPalette::ToolTipText, brush6);
palette5.setBrush(QPalette::Inactive, QPalette::WindowText, brush);
palette5.setBrush(QPalette::Inactive, QPalette::Button, brush1);
palette5.setBrush(QPalette::Inactive, QPalette::Light, brush2);
palette5.setBrush(QPalette::Inactive, QPalette::Midlight, brush3);
palette5.setBrush(QPalette::Inactive, QPalette::Dark, brush4);
palette5.setBrush(QPalette::Inactive, QPalette::Mid, brush5);
palette5.setBrush(QPalette::Inactive, QPalette::Text, brush);
palette5.setBrush(QPalette::Inactive, QPalette::BrightText, brush);
palette5.setBrush(QPalette::Inactive, QPalette::ButtonText, brush);
palette5.setBrush(QPalette::Inactive, QPalette::Base, brush6);
palette5.setBrush(QPalette::Inactive, QPalette::Window, brush1);
palette5.setBrush(QPalette::Inactive, QPalette::Shadow, brush6);
palette5.setBrush(QPalette::Inactive, QPalette::AlternateBase, brush4);
palette5.setBrush(QPalette::Inactive, QPalette::ToolTipBase, brush7);
palette5.setBrush(QPalette::Inactive, QPalette::ToolTipText, brush6);
palette5.setBrush(QPalette::Disabled, QPalette::WindowText, brush4);
palette5.setBrush(QPalette::Disabled, QPalette::Button, brush1);
palette5.setBrush(QPalette::Disabled, QPalette::Light, brush2);
palette5.setBrush(QPalette::Disabled, QPalette::Midlight, brush3);
palette5.setBrush(QPalette::Disabled, QPalette::Dark, brush4);
palette5.setBrush(QPalette::Disabled, QPalette::Mid, brush5);
palette5.setBrush(QPalette::Disabled, QPalette::Text, brush4);
palette5.setBrush(QPalette::Disabled, QPalette::BrightText, brush);
palette5.setBrush(QPalette::Disabled, QPalette::ButtonText, brush4);
palette5.setBrush(QPalette::Disabled, QPalette::Base, brush1);
palette5.setBrush(QPalette::Disabled, QPalette::Window, brush1);
palette5.setBrush(QPalette::Disabled, QPalette::Shadow, brush6);
palette5.setBrush(QPalette::Disabled, QPalette::AlternateBase, brush1);
palette5.setBrush(QPalette::Disabled, QPalette::ToolTipBase, brush7);
palette5.setBrush(QPalette::Disabled, QPalette::ToolTipText, brush6);
head->setPalette(palette5);
head->setAutoFillBackground(true);
iconsLayout = new QHBoxLayout(head);
iconsLayout->setSpacing(0);
iconsLayout->setObjectName(QStringLiteral("iconsLayout"));
iconsLayout->setContentsMargins(0, 0, 0, 0);
generalButton = new QPushButton(head);
generalButton->setObjectName(QStringLiteral("generalButton"));
generalButton->setMinimumSize(QSize(55, 35));
generalButton->setMaximumSize(QSize(55, 35));
generalButton->setFocusPolicy(Qt::NoFocus);
QIcon icon1;
icon1.addFile(QStringLiteral(":/img/add.png"), QSize(), QIcon::Normal, QIcon::Off);
generalButton->setIcon(icon1);
generalButton->setFlat(true);
iconsLayout->addWidget(generalButton);
identityButton = new QPushButton(head);
identityButton->setObjectName(QStringLiteral("identityButton"));
identityButton->setMinimumSize(QSize(55, 35));
identityButton->setMaximumSize(QSize(55, 35));
identityButton->setFocusPolicy(Qt::NoFocus);
QIcon icon2;
icon2.addFile(QStringLiteral(":/img/group.png"), QSize(), QIcon::Normal, QIcon::Off);
identityButton->setIcon(icon2);
identityButton->setFlat(true);
iconsLayout->addWidget(identityButton);
privacyButton = new QPushButton(head);
privacyButton->setObjectName(QStringLiteral("privacyButton"));
privacyButton->setMinimumSize(QSize(55, 35));
privacyButton->setMaximumSize(QSize(55, 35));
privacyButton->setFocusPolicy(Qt::NoFocus);
QIcon icon3;
icon3.addFile(QStringLiteral(":/img/transfer.png"), QSize(), QIcon::Normal, QIcon::Off);
privacyButton->setIcon(icon3);
privacyButton->setFlat(true);
iconsLayout->addWidget(privacyButton);
avButton = new QPushButton(head);
avButton->setObjectName(QStringLiteral("avButton"));
avButton->setMinimumSize(QSize(55, 35));
avButton->setMaximumSize(QSize(55, 35));
avButton->setFocusPolicy(Qt::NoFocus);
QIcon icon4;
icon4.addFile(QStringLiteral(":/img/settings.png"), QSize(), QIcon::Normal, QIcon::Off);
avButton->setIcon(icon4);
avButton->setFlat(true);
iconsLayout->addWidget(avButton);
head->setLayout(iconsLayout);
}
SettingsWidget::~SettingsWidget()
{
}
void SettingsWidget::show(Ui::MainWindow& ui)
{
ui.mainContent->layout()->addWidget(main);
ui.mainHead->layout()->addWidget(head);
main->show();
head->show();
}

View File

@ -0,0 +1,62 @@
/*
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 SETTINGSWIDGET_H
#define SETTINGSWIDGET_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 SettingsWidget : public QObject
{
Q_OBJECT
public:
SettingsWidget();
~SettingsWidget();
void show(Ui::MainWindow &ui);
public slots:
//void setFriendAddress(const QString& friendAddress);
private slots:
private:
QWidget *main, *head;
// the code pertaining to the icons is mostly copied from ui_mainwindow.h
QHBoxLayout *iconsLayout;
QPushButton *generalButton;
QPushButton *identityButton;
QPushButton *privacyButton;
QPushButton *avButton;
// now the actual pages and stuff
// ...
public:
};
#endif // SETTINGSFORM_H

View File

@ -17,7 +17,7 @@
#include "groupwidget.h"
#include "grouplist.h"
#include "group.h"
#include "settings.h"
#include "misc/settings.h"
#include "widget/form/groupchatform.h"
#include <QPalette>
#include <QMenu>

View File

@ -15,7 +15,7 @@
*/
#include "chataction.h"
#include "smileypack.h"
#include "misc/smileypack.h"
#include <QStringList>
#include <QBuffer>
#include "filetransferinstance.h"

View File

@ -17,7 +17,7 @@
#include "widget.h"
#include "ui_mainwindow.h"
#include "core.h"
#include "settings.h"
#include "misc/settings.h"
#include "friend.h"
#include "friendlist.h"
#include "widget/tool/friendrequestdialog.h"
@ -26,12 +26,11 @@
#include "group.h"
#include "widget/groupwidget.h"
#include "widget/form/groupchatform.h"
#include "style.h"
#include "misc/style.h"
#include "selfcamview.h"
#include "widget/friendlistwidget.h"
#include "camera.h"
#include "widget/form/chatform.h"
#include "widget/settingsdialog.h"
#include <QMessageBox>
#include <QDebug>
#include <QFile>
@ -156,7 +155,6 @@ Widget::Widget(QWidget *parent)
ui->statusButton->style()->polish(ui->statusButton);
camera = new Camera;
settingsDialog = new SettingsDialog(this);
// Disable some widgets until we're connected to the DHT
ui->statusButton->setEnabled(false);
@ -335,8 +333,9 @@ void Widget::onTransferClicked()
void Widget::onSettingsClicked()
{
settingsDialog->readConfig();
settingsDialog->show();
hideMainForms();
settingsWidget.show(*ui);
activeChatroomWidget = nullptr;
}
void Widget::hideMainForms()

View File

@ -19,6 +19,7 @@
#include <QMainWindow>
#include "widget/form/addfriendform.h"
#include "widget/form/settingswidget.h"
#include "widget/form/filesform.h"
#include "corestructs.h"
@ -37,7 +38,6 @@ class QMenu;
class Core;
class Camera;
class FriendListWidget;
class SettingsDialog;
class Widget : public QMainWindow
{
@ -134,8 +134,8 @@ private:
Core* core;
QThread* coreThread;
AddFriendForm friendForm;
SettingsWidget settingsWidget;
FilesForm filesForm;
SettingsDialog* settingsDialog;
static Widget* instance;
GenericChatroomWidget* activeChatroomWidget;
FriendListWidget* contactListWidget;