mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'style'
This commit is contained in:
commit
9c0d85da0c
3262
mainwindow.ui
Normal file
3262
mainwindow.ui
Normal file
File diff suppressed because it is too large
Load Diff
11
qtox.pro
11
qtox.pro
|
@ -25,7 +25,8 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
TARGET = qtox
|
TARGET = qtox
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
FORMS += widget.ui
|
FORMS += \
|
||||||
|
mainwindow.ui
|
||||||
CONFIG += c++11
|
CONFIG += c++11
|
||||||
|
|
||||||
TRANSLATIONS = translations/de.ts \
|
TRANSLATIONS = translations/de.ts \
|
||||||
|
@ -85,7 +86,9 @@ HEADERS += widget/form/addfriendform.h \
|
||||||
widget/netcamview.h \
|
widget/netcamview.h \
|
||||||
widget/tool/clickablelabel.h \
|
widget/tool/clickablelabel.h \
|
||||||
smileypack.h \
|
smileypack.h \
|
||||||
widget/emoticonswidget.h
|
widget/emoticonswidget.h \
|
||||||
|
style.h \
|
||||||
|
widget/adjustingscrollarea.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
widget/form/addfriendform.cpp \
|
widget/form/addfriendform.cpp \
|
||||||
|
@ -119,4 +122,6 @@ SOURCES += \
|
||||||
widget/netcamview.cpp \
|
widget/netcamview.cpp \
|
||||||
widget/tool/clickablelabel.cpp \
|
widget/tool/clickablelabel.cpp \
|
||||||
smileypack.cpp \
|
smileypack.cpp \
|
||||||
widget/emoticonswidget.cpp
|
widget/emoticonswidget.cpp \
|
||||||
|
style.cpp \
|
||||||
|
widget/adjustingscrollarea.cpp
|
||||||
|
|
60
settings.cpp
60
settings.cpp
|
@ -102,6 +102,11 @@ void Settings::load()
|
||||||
secondColumnHandlePosFromRight = s.value("secondColumnHandlePosFromRight", 50).toInt();
|
secondColumnHandlePosFromRight = s.value("secondColumnHandlePosFromRight", 50).toInt();
|
||||||
timestampFormat = s.value("timestampFormat", "hh:mm").toString();
|
timestampFormat = s.value("timestampFormat", "hh:mm").toString();
|
||||||
minimizeOnClose = s.value("minimizeOnClose", false).toBool();
|
minimizeOnClose = s.value("minimizeOnClose", false).toBool();
|
||||||
|
useNativeStyle = s.value("nativeStyle", false).toBool();
|
||||||
|
useNativeDecoration = s.value("nativeDecoration", true).toBool();
|
||||||
|
windowGeometry = s.value("windowGeometry", QByteArray()).toByteArray();
|
||||||
|
windowState = s.value("windowState", QByteArray()).toByteArray();
|
||||||
|
splitterState = s.value("splitterState", QByteArray()).toByteArray();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Privacy");
|
s.beginGroup("Privacy");
|
||||||
|
@ -162,6 +167,11 @@ void Settings::save(QString path)
|
||||||
s.setValue("secondColumnHandlePosFromRight", secondColumnHandlePosFromRight);
|
s.setValue("secondColumnHandlePosFromRight", secondColumnHandlePosFromRight);
|
||||||
s.setValue("timestampFormat", timestampFormat);
|
s.setValue("timestampFormat", timestampFormat);
|
||||||
s.setValue("minimizeOnClose", minimizeOnClose);
|
s.setValue("minimizeOnClose", minimizeOnClose);
|
||||||
|
s.setValue("nativeStyle", useNativeStyle);
|
||||||
|
s.setValue("nativeDecoration", useNativeDecoration);
|
||||||
|
s.setValue("windowGeometry", windowGeometry);
|
||||||
|
s.setValue("windowState", windowState);
|
||||||
|
s.setValue("splitterState", splitterState);
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Privacy");
|
s.beginGroup("Privacy");
|
||||||
|
@ -339,6 +349,56 @@ void Settings::setEmojiFontFamily(const QString &value)
|
||||||
emit emojiFontChanged();
|
emit emojiFontChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::getUseNativeStyle() const
|
||||||
|
{
|
||||||
|
return useNativeStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setUseNativeStyle(bool value)
|
||||||
|
{
|
||||||
|
useNativeStyle = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Settings::getUseNativeDecoration() const
|
||||||
|
{
|
||||||
|
return useNativeDecoration;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setUseNativeDecoration(bool value)
|
||||||
|
{
|
||||||
|
useNativeDecoration = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray Settings::getWindowGeometry() const
|
||||||
|
{
|
||||||
|
return windowGeometry;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setWindowGeometry(const QByteArray &value)
|
||||||
|
{
|
||||||
|
windowGeometry = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray Settings::getWindowState() const
|
||||||
|
{
|
||||||
|
return windowState;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setWindowState(const QByteArray &value)
|
||||||
|
{
|
||||||
|
windowState = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray Settings::getSplitterState() const
|
||||||
|
{
|
||||||
|
return splitterState;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setSplitterState(const QByteArray &value)
|
||||||
|
{
|
||||||
|
splitterState = value;
|
||||||
|
}
|
||||||
|
|
||||||
bool Settings::isMinimizeOnCloseEnabled() const
|
bool Settings::isMinimizeOnCloseEnabled() const
|
||||||
{
|
{
|
||||||
return minimizeOnClose;
|
return minimizeOnClose;
|
||||||
|
|
20
settings.h
20
settings.h
|
@ -112,6 +112,21 @@ public:
|
||||||
bool isTypingNotificationEnabled() const;
|
bool isTypingNotificationEnabled() const;
|
||||||
void setTypingNotification(bool enabled);
|
void setTypingNotification(bool enabled);
|
||||||
|
|
||||||
|
bool getUseNativeStyle() const;
|
||||||
|
void setUseNativeStyle(bool value);
|
||||||
|
|
||||||
|
bool getUseNativeDecoration() const;
|
||||||
|
void setUseNativeDecoration(bool value);
|
||||||
|
|
||||||
|
QByteArray getWindowGeometry() const;
|
||||||
|
void setWindowGeometry(const QByteArray &value);
|
||||||
|
|
||||||
|
QByteArray getWindowState() const;
|
||||||
|
void setWindowState(const QByteArray &value);
|
||||||
|
|
||||||
|
QByteArray getSplitterState() const;
|
||||||
|
void setSplitterState(const QByteArray &value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Settings();
|
Settings();
|
||||||
Settings(Settings &settings) = delete;
|
Settings(Settings &settings) = delete;
|
||||||
|
@ -147,6 +162,11 @@ private:
|
||||||
QString emojiFontFamily;
|
QString emojiFontFamily;
|
||||||
int emojiFontPointSize;
|
int emojiFontPointSize;
|
||||||
bool minimizeOnClose;
|
bool minimizeOnClose;
|
||||||
|
bool useNativeStyle;
|
||||||
|
bool useNativeDecoration;
|
||||||
|
QByteArray windowGeometry;
|
||||||
|
QByteArray windowState;
|
||||||
|
QByteArray splitterState;
|
||||||
|
|
||||||
// ChatView
|
// ChatView
|
||||||
int firstColumnHandlePos;
|
int firstColumnHandlePos;
|
||||||
|
|
35
style.cpp
Normal file
35
style.cpp
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
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 "style.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
QString Style::get(const QString &filename)
|
||||||
|
{
|
||||||
|
if (!Settings::getInstance().getUseNativeStyle())
|
||||||
|
{
|
||||||
|
QFile file(filename);
|
||||||
|
if (file.open(QFile::ReadOnly | QFile::Text))
|
||||||
|
return file.readAll();
|
||||||
|
else
|
||||||
|
qWarning() << "Style " << filename << " not found";
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString();
|
||||||
|
}
|
30
style.h
Normal file
30
style.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
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 STYLE_H
|
||||||
|
#define STYLE_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class Style
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static QString get(const QString& filename);
|
||||||
|
private:
|
||||||
|
Style();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // STYLE_H
|
45
widget/adjustingscrollarea.cpp
Normal file
45
widget/adjustingscrollarea.cpp
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
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 "adjustingscrollarea.h"
|
||||||
|
|
||||||
|
#include <QEvent>
|
||||||
|
#include <QLayout>
|
||||||
|
#include <QScrollBar>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
AdjustingScrollArea::AdjustingScrollArea(QWidget *parent) :
|
||||||
|
QScrollArea(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdjustingScrollArea::resizeEvent(QResizeEvent *ev)
|
||||||
|
{
|
||||||
|
updateGeometry();
|
||||||
|
QScrollArea::resizeEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize AdjustingScrollArea::sizeHint() const
|
||||||
|
{
|
||||||
|
if (widget())
|
||||||
|
{
|
||||||
|
int scrollbarWidth = verticalScrollBar()->isVisible() ? verticalScrollBar()->width() : 0;
|
||||||
|
return widget()->sizeHint() + QSize(scrollbarWidth, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return QScrollArea::sizeHint();
|
||||||
|
}
|
36
widget/adjustingscrollarea.h
Normal file
36
widget/adjustingscrollarea.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
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 ADJUSTINGSCROLLAREA_H
|
||||||
|
#define ADJUSTINGSCROLLAREA_H
|
||||||
|
|
||||||
|
#include <QScrollArea>
|
||||||
|
|
||||||
|
class AdjustingScrollArea : public QScrollArea
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit AdjustingScrollArea(QWidget *parent = 0);
|
||||||
|
|
||||||
|
virtual void resizeEvent(QResizeEvent *ev);
|
||||||
|
virtual QSize sizeHint() const override;
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ADJUSTINGSCROLLAREA_H
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "emoticonswidget.h"
|
#include "emoticonswidget.h"
|
||||||
#include "smileypack.h"
|
#include "smileypack.h"
|
||||||
|
#include "style.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
|
@ -26,11 +27,7 @@
|
||||||
EmoticonsWidget::EmoticonsWidget(QWidget *parent) :
|
EmoticonsWidget::EmoticonsWidget(QWidget *parent) :
|
||||||
QMenu(parent)
|
QMenu(parent)
|
||||||
{
|
{
|
||||||
QFile f(":/ui/emoticonWidget/emoticonWidget.css");
|
setStyleSheet(Style::get(":/ui/emoticonWidget/emoticonWidget.css"));
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QString pageButtonCss = f.readAll();
|
|
||||||
setStyleSheet(pageButtonCss);
|
|
||||||
|
|
||||||
setLayout(&layout);
|
setLayout(&layout);
|
||||||
layout.addWidget(&stack);
|
layout.addWidget(&stack);
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
#include "style.h"
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
@ -36,10 +37,7 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File)
|
||||||
QFont prettysmall;
|
QFont prettysmall;
|
||||||
prettysmall.setPixelSize(10);
|
prettysmall.setPixelSize(10);
|
||||||
this->setObjectName("default");
|
this->setObjectName("default");
|
||||||
QFile f0(":/ui/fileTransferWidget/fileTransferWidget.css");
|
this->setStyleSheet(Style::get(":/ui/fileTransferWidget/fileTransferWidget.css"));
|
||||||
f0.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream fileTransfertWidgetStylesheet(&f0);
|
|
||||||
this->setStyleSheet(fileTransfertWidgetStylesheet.readAll());
|
|
||||||
QPalette greybg;
|
QPalette greybg;
|
||||||
greybg.setColor(QPalette::Window, QColor(209,209,209));
|
greybg.setColor(QPalette::Window, QColor(209,209,209));
|
||||||
greybg.setColor(QPalette::Base, QColor(150,150,150));
|
greybg.setColor(QPalette::Base, QColor(150,150,150));
|
||||||
|
@ -71,20 +69,9 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File)
|
||||||
buttonWidget->setAutoFillBackground(true);
|
buttonWidget->setAutoFillBackground(true);
|
||||||
buttonWidget->setLayout(buttonLayout);
|
buttonWidget->setLayout(buttonLayout);
|
||||||
|
|
||||||
QFile f1(":/ui/stopFileButton/style.css");
|
stopFileButtonStylesheet = Style::get(":/ui/stopFileButton/style.css");
|
||||||
f1.open(QFile::ReadOnly | QFile::Text);
|
pauseFileButtonStylesheet = Style::get(":/ui/pauseFileButton/style.css");
|
||||||
QTextStream stopFileButtonStylesheetStream(&f1);
|
acceptFileButtonStylesheet = Style::get(":/ui/acceptFileButton/style.css");
|
||||||
stopFileButtonStylesheet = stopFileButtonStylesheetStream.readAll();
|
|
||||||
|
|
||||||
QFile f2(":/ui/pauseFileButton/style.css");
|
|
||||||
f2.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream pauseFileButtonStylesheetStream(&f2);
|
|
||||||
pauseFileButtonStylesheet = pauseFileButtonStylesheetStream.readAll();
|
|
||||||
|
|
||||||
QFile f3(":/ui/acceptFileButton/style.css");
|
|
||||||
f3.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream acceptFileButtonStylesheetStream(&f3);
|
|
||||||
acceptFileButtonStylesheet = acceptFileButtonStylesheetStream.readAll();
|
|
||||||
|
|
||||||
topright->setStyleSheet(stopFileButtonStylesheet);
|
topright->setStyleSheet(stopFileButtonStylesheet);
|
||||||
if (File.direction == ToxFile::SENDING)
|
if (File.direction == ToxFile::SENDING)
|
||||||
|
|
|
@ -57,7 +57,7 @@ AddFriendForm::~AddFriendForm()
|
||||||
main->deleteLater();
|
main->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddFriendForm::show(Ui::Widget &ui)
|
void AddFriendForm::show(Ui::MainWindow &ui)
|
||||||
{
|
{
|
||||||
ui.mainContent->layout()->addWidget(main);
|
ui.mainContent->layout()->addWidget(main);
|
||||||
ui.mainHead->layout()->addWidget(head);
|
ui.mainHead->layout()->addWidget(head);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#ifndef ADDFRIENDFORM_H
|
#ifndef ADDFRIENDFORM_H
|
||||||
#define ADDFRIENDFORM_H
|
#define ADDFRIENDFORM_H
|
||||||
|
|
||||||
#include "ui_widget.h"
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -33,7 +33,7 @@ public:
|
||||||
AddFriendForm();
|
AddFriendForm();
|
||||||
~AddFriendForm();
|
~AddFriendForm();
|
||||||
|
|
||||||
void show(Ui::Widget& ui);
|
void show(Ui::MainWindow &ui);
|
||||||
bool isToxId(const QString& value) const;
|
bool isToxId(const QString& value) const;
|
||||||
void showWarning(const QString& message) const;
|
void showWarning(const QString& message) const;
|
||||||
QString getMessage() const;
|
QString getMessage() const;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "widget/widget.h"
|
#include "widget/widget.h"
|
||||||
#include "widget/filetransfertwidget.h"
|
#include "widget/filetransfertwidget.h"
|
||||||
#include "widget/emoticonswidget.h"
|
#include "widget/emoticonswidget.h"
|
||||||
|
#include "style.h"
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
@ -53,16 +54,8 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
avatar->setPixmap(QPixmap(":/img/contact_dark.png"));
|
avatar->setPixmap(QPixmap(":/img/contact_dark.png"));
|
||||||
|
|
||||||
chatAreaWidget->setLayout(mainChatLayout);
|
chatAreaWidget->setLayout(mainChatLayout);
|
||||||
QString chatAreaStylesheet = "";
|
chatAreaWidget->setStyleSheet(Style::get(":/ui/chatArea/chatArea.css"));
|
||||||
try
|
|
||||||
{
|
|
||||||
QFile f(":/ui/chatArea/chatArea.css");
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream chatAreaStylesheetStream(&f);
|
|
||||||
chatAreaStylesheet = chatAreaStylesheetStream.readAll();
|
|
||||||
}
|
|
||||||
catch (int e) {}
|
|
||||||
chatArea->setStyleSheet(chatAreaStylesheet);
|
|
||||||
chatArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
chatArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
chatArea->setWidgetResizable(true);
|
chatArea->setWidgetResizable(true);
|
||||||
chatArea->setContextMenuPolicy(Qt::CustomContextMenu);
|
chatArea->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
@ -73,76 +66,19 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
|
|
||||||
footButtonsSmall->setSpacing(2);
|
footButtonsSmall->setSpacing(2);
|
||||||
|
|
||||||
QString msgEditStylesheet = "";
|
msgEdit->setStyleSheet(Style::get(":/ui/msgEdit/msgEdit.css"));
|
||||||
try
|
|
||||||
{
|
|
||||||
QFile f(":/ui/msgEdit/msgEdit.css");
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream msgEditStylesheetStream(&f);
|
|
||||||
msgEditStylesheet = msgEditStylesheetStream.readAll();
|
|
||||||
}
|
|
||||||
catch (int e) {}
|
|
||||||
msgEdit->setStyleSheet(msgEditStylesheet);
|
|
||||||
msgEdit->setFixedHeight(50);
|
msgEdit->setFixedHeight(50);
|
||||||
msgEdit->setFrameStyle(QFrame::NoFrame);
|
msgEdit->setFrameStyle(QFrame::NoFrame);
|
||||||
|
|
||||||
QString sendButtonStylesheet = "";
|
sendButton->setStyleSheet(Style::get(":/ui/sendButton/sendButton.css"));
|
||||||
try
|
fileButton->setStyleSheet(Style::get(":/ui/fileButton/fileButton.css"));
|
||||||
{
|
emoteButton->setStyleSheet(Style::get(":/ui/emoteButton/emoteButton.css"));
|
||||||
QFile f(":/ui/sendButton/sendButton.css");
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream sendButtonStylesheetStream(&f);
|
|
||||||
sendButtonStylesheet = sendButtonStylesheetStream.readAll();
|
|
||||||
}
|
|
||||||
catch (int e) {}
|
|
||||||
sendButton->setStyleSheet(sendButtonStylesheet);
|
|
||||||
|
|
||||||
QString fileButtonStylesheet = "";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QFile f(":/ui/fileButton/fileButton.css");
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream fileButtonStylesheetStream(&f);
|
|
||||||
fileButtonStylesheet = fileButtonStylesheetStream.readAll();
|
|
||||||
}
|
|
||||||
catch (int e) {}
|
|
||||||
fileButton->setStyleSheet(fileButtonStylesheet);
|
|
||||||
|
|
||||||
|
|
||||||
QString emoteButtonStylesheet = "";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QFile f(":/ui/emoteButton/emoteButton.css");
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream emoteButtonStylesheetStream(&f);
|
|
||||||
emoteButtonStylesheet = emoteButtonStylesheetStream.readAll();
|
|
||||||
}
|
|
||||||
catch (int e) {}
|
|
||||||
emoteButton->setStyleSheet(emoteButtonStylesheet);
|
|
||||||
|
|
||||||
QString callButtonStylesheet = "";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QFile f(":/ui/callButton/callButton.css");
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream callButtonStylesheetStream(&f);
|
|
||||||
callButtonStylesheet = callButtonStylesheetStream.readAll();
|
|
||||||
}
|
|
||||||
catch (int e) {}
|
|
||||||
callButton->setObjectName("green");
|
callButton->setObjectName("green");
|
||||||
callButton->setStyleSheet(callButtonStylesheet);
|
callButton->setStyleSheet(Style::get(":/ui/callButton/callButton.css"));
|
||||||
|
|
||||||
QString videoButtonStylesheet = "";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QFile f(":/ui/videoButton/videoButton.css");
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream videoButtonStylesheetStream(&f);
|
|
||||||
videoButtonStylesheet = videoButtonStylesheetStream.readAll();
|
|
||||||
}
|
|
||||||
catch (int e) {}
|
|
||||||
videoButton->setObjectName("green");
|
videoButton->setObjectName("green");
|
||||||
videoButton->setStyleSheet(videoButtonStylesheet);
|
videoButton->setStyleSheet(Style::get(":/ui/videoButton/videoButton.css"));
|
||||||
|
|
||||||
main->setLayout(mainLayout);
|
main->setLayout(mainLayout);
|
||||||
mainLayout->addWidget(chatArea);
|
mainLayout->addWidget(chatArea);
|
||||||
|
@ -201,7 +137,7 @@ ChatForm::~ChatForm()
|
||||||
delete netcam;
|
delete netcam;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::show(Ui::Widget &ui)
|
void ChatForm::show(Ui::MainWindow &ui)
|
||||||
{
|
{
|
||||||
ui.mainContent->layout()->addWidget(main);
|
ui.mainContent->layout()->addWidget(main);
|
||||||
ui.mainHead->layout()->addWidget(head);
|
ui.mainHead->layout()->addWidget(head);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
|
|
||||||
#include "widget/tool/chattextedit.h"
|
#include "widget/tool/chattextedit.h"
|
||||||
#include "ui_widget.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "widget/netcamview.h"
|
#include "widget/netcamview.h"
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class ChatForm : public QObject
|
||||||
public:
|
public:
|
||||||
ChatForm(Friend* chatFriend);
|
ChatForm(Friend* chatFriend);
|
||||||
~ChatForm();
|
~ChatForm();
|
||||||
void show(Ui::Widget& ui);
|
void show(Ui::MainWindow &ui);
|
||||||
void setName(QString newName);
|
void setName(QString newName);
|
||||||
void setStatusMessage(QString newMessage);
|
void setStatusMessage(QString newMessage);
|
||||||
void addFriendMessage(QString message);
|
void addFriendMessage(QString message);
|
||||||
|
|
|
@ -50,7 +50,7 @@ FilesForm::~FilesForm()
|
||||||
// I'm not too bummed about removing it
|
// I'm not too bummed about removing it
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilesForm::show(Ui::Widget& ui)
|
void FilesForm::show(Ui::MainWindow& ui)
|
||||||
{
|
{
|
||||||
ui.mainContent->layout()->addWidget(&main);
|
ui.mainContent->layout()->addWidget(&main);
|
||||||
ui.mainHead->layout()->addWidget(head);
|
ui.mainHead->layout()->addWidget(head);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#ifndef FILESFORM_H
|
#ifndef FILESFORM_H
|
||||||
#define FILESFORM_H
|
#define FILESFORM_H
|
||||||
|
|
||||||
#include "ui_widget.h"
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
|
@ -37,7 +37,7 @@ public:
|
||||||
FilesForm();
|
FilesForm();
|
||||||
~FilesForm();
|
~FilesForm();
|
||||||
|
|
||||||
void show(Ui::Widget& ui);
|
void show(Ui::MainWindow &ui);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onFileDownloadComplete(const QString& path);
|
void onFileDownloadComplete(const QString& path);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "widget/widget.h"
|
#include "widget/widget.h"
|
||||||
#include "friend.h"
|
#include "friend.h"
|
||||||
#include "friendlist.h"
|
#include "friendlist.h"
|
||||||
|
#include "style.h"
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
@ -55,16 +56,8 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
|
||||||
namesList->setFont(small);
|
namesList->setFont(small);
|
||||||
|
|
||||||
chatAreaWidget->setLayout(mainChatLayout);
|
chatAreaWidget->setLayout(mainChatLayout);
|
||||||
QString chatAreaStylesheet = "";
|
|
||||||
try
|
chatArea->setStyleSheet(Style::get(":/ui/chatArea/chatArea.css"));
|
||||||
{
|
|
||||||
QFile f(":/ui/chatArea/chatArea.css");
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream chatAreaStylesheetStream(&f);
|
|
||||||
chatAreaStylesheet = chatAreaStylesheetStream.readAll();
|
|
||||||
}
|
|
||||||
catch (int e) {}
|
|
||||||
chatArea->setStyleSheet(chatAreaStylesheet);
|
|
||||||
chatArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
chatArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
chatArea->setWidgetResizable(true);
|
chatArea->setWidgetResizable(true);
|
||||||
chatArea->setContextMenuPolicy(Qt::CustomContextMenu);
|
chatArea->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
@ -73,35 +66,15 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
|
||||||
mainChatLayout->setColumnStretch(1,1);
|
mainChatLayout->setColumnStretch(1,1);
|
||||||
mainChatLayout->setSpacing(10);
|
mainChatLayout->setSpacing(10);
|
||||||
|
|
||||||
|
|
||||||
QString msgEditStylesheet = "";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QFile f(":/ui/msgEdit/msgEdit.css");
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream msgEditStylesheetStream(&f);
|
|
||||||
msgEditStylesheet = msgEditStylesheetStream.readAll();
|
|
||||||
}
|
|
||||||
catch (int e) {}
|
|
||||||
msgEdit->setObjectName("group");
|
msgEdit->setObjectName("group");
|
||||||
msgEdit->setStyleSheet(msgEditStylesheet);
|
msgEdit->setStyleSheet(Style::get(":/ui/msgEdit/msgEdit.css"));
|
||||||
msgEdit->setFixedHeight(50);
|
msgEdit->setFixedHeight(50);
|
||||||
msgEdit->setFrameStyle(QFrame::NoFrame);
|
msgEdit->setFrameStyle(QFrame::NoFrame);
|
||||||
|
|
||||||
mainChatLayout->setColumnStretch(1,1);
|
mainChatLayout->setColumnStretch(1,1);
|
||||||
mainChatLayout->setHorizontalSpacing(10);
|
mainChatLayout->setHorizontalSpacing(10);
|
||||||
|
|
||||||
QString sendButtonStylesheet = "";
|
sendButton->setStyleSheet(Style::get(":/ui/sendButton/sendButton.css"));
|
||||||
try
|
|
||||||
{
|
|
||||||
QFile f(":/ui/sendButton/sendButton.css");
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream sendButtonStylesheetStream(&f);
|
|
||||||
sendButtonStylesheet = sendButtonStylesheetStream.readAll();
|
|
||||||
}
|
|
||||||
catch (int e) {}
|
|
||||||
sendButton->setStyleSheet(sendButtonStylesheet);
|
|
||||||
|
|
||||||
sendButton->setFixedSize(50, 50);
|
sendButton->setFixedSize(50, 50);
|
||||||
|
|
||||||
main->setLayout(mainLayout);
|
main->setLayout(mainLayout);
|
||||||
|
@ -142,7 +115,7 @@ GroupChatForm::~GroupChatForm()
|
||||||
delete main;
|
delete main;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupChatForm::show(Ui::Widget &ui)
|
void GroupChatForm::show(Ui::MainWindow &ui)
|
||||||
{
|
{
|
||||||
ui.mainContent->layout()->addWidget(main);
|
ui.mainContent->layout()->addWidget(main);
|
||||||
ui.mainHead->layout()->addWidget(head);
|
ui.mainHead->layout()->addWidget(head);
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
#include "widget/tool/chattextedit.h"
|
#include "widget/tool/chattextedit.h"
|
||||||
#include "ui_widget.h"
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
// Spacing in px inserted when the author of the last message changes
|
// Spacing in px inserted when the author of the last message changes
|
||||||
#define AUTHOR_CHANGE_SPACING 5
|
#define AUTHOR_CHANGE_SPACING 5
|
||||||
|
@ -40,7 +40,7 @@ class GroupChatForm : public QObject
|
||||||
public:
|
public:
|
||||||
GroupChatForm(Group* chatGroup);
|
GroupChatForm(Group* chatGroup);
|
||||||
~GroupChatForm();
|
~GroupChatForm();
|
||||||
void show(Ui::Widget& ui);
|
void show(Ui::MainWindow &ui);
|
||||||
void setName(QString newName);
|
void setName(QString newName);
|
||||||
void addGroupMessage(QString message, int peerId);
|
void addGroupMessage(QString message, int peerId);
|
||||||
void addMessage(QString author, QString message, QString date=QTime::currentTime().toString("hh:mm"));
|
void addMessage(QString author, QString message, QString date=QTime::currentTime().toString("hh:mm"));
|
||||||
|
|
|
@ -93,7 +93,7 @@ void SettingsForm::setFriendAddress(const QString& friendAddress)
|
||||||
id.setText(friendAddress);
|
id.setText(friendAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsForm::show(Ui::Widget &ui)
|
void SettingsForm::show(Ui::MainWindow &ui)
|
||||||
{
|
{
|
||||||
name.setText(ui.nameLabel->text());
|
name.setText(ui.nameLabel->text());
|
||||||
statusText.setText(ui.statusLabel->text());
|
statusText.setText(ui.statusLabel->text());
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include "widget/tool/clickablelabel.h"
|
#include "widget/tool/clickablelabel.h"
|
||||||
#include "ui_widget.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "widget/selfcamview.h"
|
#include "widget/selfcamview.h"
|
||||||
|
|
||||||
class SettingsForm : public QObject
|
class SettingsForm : public QObject
|
||||||
|
@ -38,7 +38,7 @@ public:
|
||||||
SettingsForm();
|
SettingsForm();
|
||||||
~SettingsForm();
|
~SettingsForm();
|
||||||
|
|
||||||
void show(Ui::Widget& ui);
|
void show(Ui::MainWindow &ui);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setFriendAddress(const QString& friendAddress);
|
void setFriendAddress(const QString& friendAddress);
|
||||||
|
|
|
@ -25,9 +25,9 @@
|
||||||
FriendWidget::FriendWidget(int FriendId, QString id)
|
FriendWidget::FriendWidget(int FriendId, QString id)
|
||||||
: friendId(FriendId)
|
: friendId(FriendId)
|
||||||
{
|
{
|
||||||
|
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||||
this->setMouseTracking(true);
|
this->setMouseTracking(true);
|
||||||
this->setAutoFillBackground(true);
|
this->setAutoFillBackground(true);
|
||||||
this->setFixedWidth(225);
|
|
||||||
this->setFixedHeight(55);
|
this->setFixedHeight(55);
|
||||||
this->setLayout(&layout);
|
this->setLayout(&layout);
|
||||||
layout.setSpacing(0);
|
layout.setSpacing(0);
|
||||||
|
@ -53,6 +53,9 @@ FriendWidget::FriendWidget(int FriendId, QString id)
|
||||||
pal3.setColor(QPalette::Background, QColor(65,65,65,255));
|
pal3.setColor(QPalette::Background, QColor(65,65,65,255));
|
||||||
this->setPalette(pal3);
|
this->setPalette(pal3);
|
||||||
|
|
||||||
|
name.setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||||
|
statusMessage.setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||||
|
|
||||||
textLayout.addStretch();
|
textLayout.addStretch();
|
||||||
textLayout.addWidget(&name);
|
textLayout.addWidget(&name);
|
||||||
textLayout.addWidget(&statusMessage);
|
textLayout.addWidget(&statusMessage);
|
||||||
|
@ -68,11 +71,13 @@ FriendWidget::FriendWidget(int FriendId, QString id)
|
||||||
layout.addSpacing(5);
|
layout.addSpacing(5);
|
||||||
|
|
||||||
isActiveWidget = 0;
|
isActiveWidget = 0;
|
||||||
}
|
|
||||||
|
|
||||||
void FriendWidget::setNewFixedWidth(int newWidth)
|
layout.invalidate();
|
||||||
{
|
layout.update();
|
||||||
this->setFixedWidth(newWidth);
|
layout.activate();
|
||||||
|
updateGeometry();
|
||||||
|
|
||||||
|
qDebug() << "friend" << minimumSizeHint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendWidget::mouseReleaseEvent (QMouseEvent*)
|
void FriendWidget::mouseReleaseEvent (QMouseEvent*)
|
||||||
|
|
|
@ -34,7 +34,6 @@ public:
|
||||||
void leaveEvent(QEvent* event);
|
void leaveEvent(QEvent* event);
|
||||||
void setAsActiveChatroom();
|
void setAsActiveChatroom();
|
||||||
void setAsInactiveChatroom();
|
void setAsInactiveChatroom();
|
||||||
void setNewFixedWidth(int newWidth);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void friendWidgetClicked(FriendWidget* widget);
|
void friendWidgetClicked(FriendWidget* widget);
|
||||||
|
|
|
@ -27,7 +27,6 @@ GroupWidget::GroupWidget(int GroupId, QString Name)
|
||||||
this->setMouseTracking(true);
|
this->setMouseTracking(true);
|
||||||
this->setAutoFillBackground(true);
|
this->setAutoFillBackground(true);
|
||||||
this->setLayout(&layout);
|
this->setLayout(&layout);
|
||||||
this->setFixedWidth(225);
|
|
||||||
this->setFixedHeight(55);
|
this->setFixedHeight(55);
|
||||||
layout.setSpacing(0);
|
layout.setSpacing(0);
|
||||||
layout.setMargin(0);
|
layout.setMargin(0);
|
||||||
|
@ -72,11 +71,6 @@ GroupWidget::GroupWidget(int GroupId, QString Name)
|
||||||
isActiveWidget = 0;
|
isActiveWidget = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupWidget::setNewFixedWidth(int newWidth)
|
|
||||||
{
|
|
||||||
this->setFixedWidth(newWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GroupWidget::mouseReleaseEvent (QMouseEvent*)
|
void GroupWidget::mouseReleaseEvent (QMouseEvent*)
|
||||||
{
|
{
|
||||||
emit groupWidgetClicked(this);
|
emit groupWidgetClicked(this);
|
||||||
|
|
|
@ -33,7 +33,8 @@ public:
|
||||||
void contextMenuEvent(QContextMenuEvent * event);
|
void contextMenuEvent(QContextMenuEvent * event);
|
||||||
void enterEvent(QEvent* event);
|
void enterEvent(QEvent* event);
|
||||||
void leaveEvent(QEvent* event);
|
void leaveEvent(QEvent* event);
|
||||||
|
void setAsInactiveChatroom();
|
||||||
|
void setAsActiveChatroom();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void groupWidgetClicked(GroupWidget* widget);
|
void groupWidgetClicked(GroupWidget* widget);
|
||||||
|
@ -44,9 +45,6 @@ public:
|
||||||
QLabel avatar, name, nusers, statusPic;
|
QLabel avatar, name, nusers, statusPic;
|
||||||
QHBoxLayout layout;
|
QHBoxLayout layout;
|
||||||
QVBoxLayout textLayout;
|
QVBoxLayout textLayout;
|
||||||
void setAsInactiveChatroom();
|
|
||||||
void setAsActiveChatroom();
|
|
||||||
void setNewFixedWidth(int newWidth);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QColor lastColor;
|
QColor lastColor;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "ui_widget.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "friend.h"
|
#include "friend.h"
|
||||||
#include "friendlist.h"
|
#include "friendlist.h"
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "widget/groupwidget.h"
|
#include "widget/groupwidget.h"
|
||||||
#include "widget/form/groupchatform.h"
|
#include "widget/form/groupchatform.h"
|
||||||
|
#include "style.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QSound>
|
#include <QSound>
|
||||||
|
@ -40,61 +41,39 @@
|
||||||
|
|
||||||
Widget *Widget::instance{nullptr};
|
Widget *Widget::instance{nullptr};
|
||||||
|
|
||||||
Widget::Widget(QWidget *parent) :
|
Widget::Widget(QWidget *parent)
|
||||||
QWidget(parent), ui(new Ui::Widget), activeFriendWidget{nullptr}, activeGroupWidget{nullptr}
|
: QMainWindow(parent),
|
||||||
|
ui(new Ui::MainWindow),
|
||||||
|
activeFriendWidget{nullptr},
|
||||||
|
activeGroupWidget{nullptr}
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
QSettings settings(Settings::getInstance().getSettingsDirPath() + '/' + "windowSettings.ini", QSettings::IniFormat);
|
ui->statusbar->hide();
|
||||||
if (!settings.contains("useNativeTheme"))
|
ui->menubar->hide();
|
||||||
useNativeTheme = 1;
|
|
||||||
else
|
|
||||||
useNativeTheme = settings.value("useNativeTheme").toInt();
|
|
||||||
|
|
||||||
if (useNativeTheme)
|
//restore window state
|
||||||
|
restoreGeometry(Settings::getInstance().getWindowGeometry());
|
||||||
|
restoreState(Settings::getInstance().getWindowState());
|
||||||
|
ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState());
|
||||||
|
|
||||||
|
if (Settings::getInstance().getUseNativeDecoration())
|
||||||
{
|
{
|
||||||
ui->titleBar->hide();
|
ui->titleBar->hide();
|
||||||
this->layout()->setContentsMargins(0, 0, 0, 0);
|
this->layout()->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
QString friendListStylesheet = "";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QFile f(":ui/friendList/friendList.css");
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream friendListStylesheetStream(&f);
|
|
||||||
friendListStylesheet = friendListStylesheetStream.readAll();
|
|
||||||
}
|
|
||||||
catch (int e) {}
|
|
||||||
ui->friendList->setObjectName("friendList");
|
ui->friendList->setObjectName("friendList");
|
||||||
ui->friendList->setStyleSheet(friendListStylesheet);
|
ui->friendList->setStyleSheet(Style::get(":ui/friendList/friendList.css"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QString windowStylesheet = "";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QFile f(":ui/window/window.css");
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream windowStylesheetStream(&f);
|
|
||||||
windowStylesheet = windowStylesheetStream.readAll();
|
|
||||||
}
|
|
||||||
catch (int e) {}
|
|
||||||
this->setObjectName("activeWindow");
|
this->setObjectName("activeWindow");
|
||||||
this->setStyleSheet(windowStylesheet);
|
this->setStyleSheet(Style::get(":ui/window/window.css"));
|
||||||
ui->statusPanel->setStyleSheet(QString(""));
|
ui->statusPanel->setStyleSheet(QString(""));
|
||||||
ui->friendList->setStyleSheet(QString(""));
|
ui->friendList->setStyleSheet(QString(""));
|
||||||
|
|
||||||
QString friendListStylesheet = "";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QFile f(":ui/friendList/friendList.css");
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream friendListStylesheetStream(&f);
|
|
||||||
friendListStylesheet = friendListStylesheetStream.readAll();
|
|
||||||
}
|
|
||||||
catch (int e) {}
|
|
||||||
ui->friendList->setObjectName("friendList");
|
ui->friendList->setObjectName("friendList");
|
||||||
ui->friendList->setStyleSheet(friendListStylesheet);
|
ui->friendList->setStyleSheet(Style::get(":ui/friendList/friendList.css"));
|
||||||
|
|
||||||
ui->tbMenu->setIcon(QIcon(":ui/window/applicationIcon.png"));
|
ui->tbMenu->setIcon(QIcon(":ui/window/applicationIcon.png"));
|
||||||
ui->pbMin->setObjectName("minimizeButton");
|
ui->pbMin->setObjectName("minimizeButton");
|
||||||
|
@ -119,24 +98,11 @@ Widget::Widget(QWidget *parent) :
|
||||||
resizeDiagSupEsq = false;
|
resizeDiagSupEsq = false;
|
||||||
resizeDiagSupDer = false;
|
resizeDiagSupDer = false;
|
||||||
|
|
||||||
QSettings settings(Settings::getInstance().getSettingsDirPath() + '/' + "windowSettings.ini", QSettings::IniFormat);
|
if (isMaximized())
|
||||||
QRect geo = settings.value("geometry").toRect();
|
|
||||||
|
|
||||||
if (geo.height() > 0 and geo.x() < QApplication::desktop()->width() and geo.width() > 0 and geo.y() < QApplication::desktop()->height())
|
|
||||||
this->setGeometry(geo);
|
|
||||||
|
|
||||||
if (settings.value("maximized").toBool())
|
|
||||||
{
|
{
|
||||||
showMaximized();
|
showMaximized();
|
||||||
ui->pbMax->setObjectName("restoreButton");
|
ui->pbMax->setObjectName("restoreButton");
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QWidget*> widgets = this->findChildren<QWidget*>();
|
|
||||||
|
|
||||||
foreach (QWidget *widget, widgets)
|
|
||||||
{
|
|
||||||
widget->setMouseTracking(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isWindowMinimized = 0;
|
isWindowMinimized = 0;
|
||||||
|
@ -145,11 +111,12 @@ Widget::Widget(QWidget *parent) :
|
||||||
ui->mainHead->setLayout(new QVBoxLayout());
|
ui->mainHead->setLayout(new QVBoxLayout());
|
||||||
ui->mainHead->layout()->setMargin(0);
|
ui->mainHead->layout()->setMargin(0);
|
||||||
ui->mainHead->layout()->setSpacing(0);
|
ui->mainHead->layout()->setSpacing(0);
|
||||||
|
|
||||||
QWidget* friendListWidget = new QWidget();
|
QWidget* friendListWidget = new QWidget();
|
||||||
friendListWidget->setLayout(new QVBoxLayout());
|
friendListWidget->setLayout(new QVBoxLayout());
|
||||||
friendListWidget->layout()->setSpacing(0);
|
friendListWidget->layout()->setSpacing(0);
|
||||||
friendListWidget->layout()->setMargin(0);
|
friendListWidget->layout()->setMargin(0);
|
||||||
friendListWidget->setLayoutDirection(Qt::LeftToRight);
|
friendListWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||||
ui->friendList->setWidget(friendListWidget);
|
ui->friendList->setWidget(friendListWidget);
|
||||||
|
|
||||||
// delay setting username and message until Core inits
|
// delay setting username and message until Core inits
|
||||||
|
@ -157,12 +124,8 @@ Widget::Widget(QWidget *parent) :
|
||||||
ui->nameLabel->label->setStyleSheet("QLabel { color : white; font-size: 11pt; font-weight:bold;}");
|
ui->nameLabel->label->setStyleSheet("QLabel { color : white; font-size: 11pt; font-weight:bold;}");
|
||||||
//ui->statusLabel->setText(core->getStatusMessage());
|
//ui->statusLabel->setText(core->getStatusMessage());
|
||||||
ui->statusLabel->label->setStyleSheet("QLabel { color : white; font-size: 8pt;}");
|
ui->statusLabel->label->setStyleSheet("QLabel { color : white; font-size: 8pt;}");
|
||||||
ui->friendList->widget()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
|
|
||||||
QFile f1(":/ui/statusButton/statusButton.css");
|
ui->statusButton->setStyleSheet(Style::get(":/ui/statusButton/statusButton.css"));
|
||||||
f1.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream statusButtonStylesheetStream(&f1);
|
|
||||||
ui->statusButton->setStyleSheet(statusButtonStylesheetStream.readAll());
|
|
||||||
|
|
||||||
QMenu *statusButtonMenu = new QMenu(ui->statusButton);
|
QMenu *statusButtonMenu = new QMenu(ui->statusButton);
|
||||||
QAction* setStatusOnline = statusButtonMenu->addAction(tr("Online","Button to set your status to 'Online'"));
|
QAction* setStatusOnline = statusButtonMenu->addAction(tr("Online","Button to set your status to 'Online'"));
|
||||||
|
@ -173,13 +136,6 @@ Widget::Widget(QWidget *parent) :
|
||||||
setStatusBusy->setIcon(QIcon(":ui/statusButton/dot_busy.png"));
|
setStatusBusy->setIcon(QIcon(":ui/statusButton/dot_busy.png"));
|
||||||
ui->statusButton->setMenu(statusButtonMenu);
|
ui->statusButton->setMenu(statusButtonMenu);
|
||||||
|
|
||||||
|
|
||||||
this->setMouseTracking(true);
|
|
||||||
|
|
||||||
QList<QWidget*> widgets = this->findChildren<QWidget*>();
|
|
||||||
foreach (QWidget *widget, widgets)
|
|
||||||
widget->setMouseTracking(true);
|
|
||||||
|
|
||||||
ui->titleBar->setMouseTracking(true);
|
ui->titleBar->setMouseTracking(true);
|
||||||
ui->LTitle->setMouseTracking(true);
|
ui->LTitle->setMouseTracking(true);
|
||||||
ui->tbMenu->setMouseTracking(true);
|
ui->tbMenu->setMouseTracking(true);
|
||||||
|
@ -188,11 +144,11 @@ Widget::Widget(QWidget *parent) :
|
||||||
ui->pbClose->setMouseTracking(true);
|
ui->pbClose->setMouseTracking(true);
|
||||||
ui->statusHead->setMouseTracking(true);
|
ui->statusHead->setMouseTracking(true);
|
||||||
|
|
||||||
ui->friendList->viewport()->installEventFilter(this);
|
//ui->friendList->viewport()->installEventFilter(this);
|
||||||
|
|
||||||
QList<int> currentSizes = ui->centralWidget->sizes();
|
// disable proportional scaling
|
||||||
currentSizes[0] = 225;
|
ui->mainSplitter->setStretchFactor(0,0);
|
||||||
ui->centralWidget->setSizes(currentSizes);
|
ui->mainSplitter->setStretchFactor(1,1);
|
||||||
|
|
||||||
ui->statusButton->setObjectName("offline");
|
ui->statusButton->setObjectName("offline");
|
||||||
ui->statusButton->style()->polish(ui->statusButton);
|
ui->statusButton->style()->polish(ui->statusButton);
|
||||||
|
@ -241,7 +197,6 @@ Widget::Widget(QWidget *parent) :
|
||||||
connect(this, &Widget::friendRequested, core, &Core::requestFriendship);
|
connect(this, &Widget::friendRequested, core, &Core::requestFriendship);
|
||||||
connect(this, &Widget::friendRequestAccepted, core, &Core::acceptFriendRequest);
|
connect(this, &Widget::friendRequestAccepted, core, &Core::acceptFriendRequest);
|
||||||
|
|
||||||
connect(ui->centralWidget, SIGNAL(splitterMoved(int,int)),this, SLOT(splitterMoved(int,int)));
|
|
||||||
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(onAddClicked()));
|
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(onAddClicked()));
|
||||||
connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked()));
|
connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked()));
|
||||||
connect(ui->transferButton, SIGNAL(clicked()), this, SLOT(onTransferClicked()));
|
connect(ui->transferButton, SIGNAL(clicked()), this, SLOT(onTransferClicked()));
|
||||||
|
@ -279,10 +234,6 @@ Widget::~Widget()
|
||||||
for (Group* g : GroupList::groupList)
|
for (Group* g : GroupList::groupList)
|
||||||
delete g;
|
delete g;
|
||||||
GroupList::groupList.clear();
|
GroupList::groupList.clear();
|
||||||
QSettings settings(Settings::getInstance().getSettingsDirPath() + '/' + "windowSettings.ini", QSettings::IniFormat);
|
|
||||||
settings.setValue("geometry", geometry());
|
|
||||||
settings.setValue("maximized", isMaximized());
|
|
||||||
settings.setValue("useNativeTheme", useNativeTheme);
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,27 +244,17 @@ Widget* Widget::getInstance()
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Super ugly hack to enable resizable friend widgets
|
|
||||||
//There should be a way to set them to resize automagicly, but I can't seem to find it.
|
|
||||||
void Widget::splitterMoved(int, int)
|
|
||||||
{
|
|
||||||
updateFriendListWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
QThread* Widget::getCoreThread()
|
QThread* Widget::getCoreThread()
|
||||||
{
|
{
|
||||||
return coreThread;
|
return coreThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::updateFriendListWidth()
|
void Widget::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
int newWidth = ui->friendList->width();
|
Settings::getInstance().setWindowGeometry(saveGeometry());
|
||||||
for (Friend* f : FriendList::friendList)
|
Settings::getInstance().setWindowState(saveState());
|
||||||
if (f->widget != nullptr)
|
Settings::getInstance().setSplitterState(ui->mainSplitter->saveState());
|
||||||
f->widget->setNewFixedWidth(newWidth);
|
QWidget::closeEvent(event);
|
||||||
for (Group* g : GroupList::groupList)
|
|
||||||
if (g->widget != nullptr)
|
|
||||||
g->widget->setNewFixedWidth(newWidth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Widget::getUsername()
|
QString Widget::getUsername()
|
||||||
|
@ -475,7 +416,6 @@ void Widget::addFriend(int friendId, const QString &userId)
|
||||||
QWidget* widget = ui->friendList->widget();
|
QWidget* widget = ui->friendList->widget();
|
||||||
QLayout* layout = widget->layout();
|
QLayout* layout = widget->layout();
|
||||||
layout->addWidget(newfriend->widget);
|
layout->addWidget(newfriend->widget);
|
||||||
updateFriendListWidth();
|
|
||||||
connect(newfriend->widget, SIGNAL(friendWidgetClicked(FriendWidget*)), this, SLOT(onFriendWidgetClicked(FriendWidget*)));
|
connect(newfriend->widget, SIGNAL(friendWidgetClicked(FriendWidget*)), this, SLOT(onFriendWidgetClicked(FriendWidget*)));
|
||||||
connect(newfriend->widget, SIGNAL(removeFriend(int)), this, SLOT(removeFriend(int)));
|
connect(newfriend->widget, SIGNAL(removeFriend(int)), this, SLOT(removeFriend(int)));
|
||||||
connect(newfriend->widget, SIGNAL(copyFriendIdToClipboard(int)), this, SLOT(copyFriendIdToClipboard(int)));
|
connect(newfriend->widget, SIGNAL(copyFriendIdToClipboard(int)), this, SLOT(copyFriendIdToClipboard(int)));
|
||||||
|
@ -682,7 +622,7 @@ void Widget::onGroupMessageReceived(int groupnumber, int friendgroupnumber, cons
|
||||||
newMessageAlert();
|
newMessageAlert();
|
||||||
g->hasNewMessages = 1;
|
g->hasNewMessages = 1;
|
||||||
g->userWasMentioned = 1;
|
g->userWasMentioned = 1;
|
||||||
if (useNativeTheme)
|
if (Settings::getInstance().getUseNativeDecoration())
|
||||||
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_online_notification.png"));
|
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_online_notification.png"));
|
||||||
else
|
else
|
||||||
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_groupchat_notification.png"));
|
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_groupchat_notification.png"));
|
||||||
|
@ -691,7 +631,7 @@ void Widget::onGroupMessageReceived(int groupnumber, int friendgroupnumber, cons
|
||||||
if (g->hasNewMessages == 0)
|
if (g->hasNewMessages == 0)
|
||||||
{
|
{
|
||||||
g->hasNewMessages = 1;
|
g->hasNewMessages = 1;
|
||||||
if (useNativeTheme)
|
if (Settings::getInstance().getUseNativeDecoration())
|
||||||
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_online_notification.png"));
|
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_online_notification.png"));
|
||||||
else
|
else
|
||||||
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_groupchat_newmessages.png"));
|
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_groupchat_newmessages.png"));
|
||||||
|
@ -738,7 +678,7 @@ void Widget::onGroupWidgetClicked(GroupWidget* widget)
|
||||||
{
|
{
|
||||||
g->hasNewMessages = 0;
|
g->hasNewMessages = 0;
|
||||||
g->userWasMentioned = 0;
|
g->userWasMentioned = 0;
|
||||||
if (useNativeTheme)
|
if (Settings::getInstance().getUseNativeDecoration())
|
||||||
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_online.png"));
|
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_online.png"));
|
||||||
else
|
else
|
||||||
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_groupchat.png"));
|
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_groupchat.png"));
|
||||||
|
@ -777,9 +717,9 @@ Group *Widget::createGroup(int groupId)
|
||||||
QWidget* widget = ui->friendList->widget();
|
QWidget* widget = ui->friendList->widget();
|
||||||
QLayout* layout = widget->layout();
|
QLayout* layout = widget->layout();
|
||||||
layout->addWidget(newgroup->widget);
|
layout->addWidget(newgroup->widget);
|
||||||
if (!useNativeTheme)
|
if (!Settings::getInstance().getUseNativeDecoration())
|
||||||
newgroup->widget->statusPic.setPixmap(QPixmap(":img/status/dot_groupchat.png"));
|
newgroup->widget->statusPic.setPixmap(QPixmap(":img/status/dot_groupchat.png"));
|
||||||
updateFriendListWidth();
|
|
||||||
connect(newgroup->widget, SIGNAL(groupWidgetClicked(GroupWidget*)), this, SLOT(onGroupWidgetClicked(GroupWidget*)));
|
connect(newgroup->widget, SIGNAL(groupWidgetClicked(GroupWidget*)), this, SLOT(onGroupWidgetClicked(GroupWidget*)));
|
||||||
connect(newgroup->widget, SIGNAL(removeGroup(int)), this, SLOT(removeGroup(int)));
|
connect(newgroup->widget, SIGNAL(removeGroup(int)), this, SLOT(removeGroup(int)));
|
||||||
connect(newgroup->chatForm, SIGNAL(sendMessage(int,QString)), core, SLOT(sendGroupMessage(int,QString)));
|
connect(newgroup->chatForm, SIGNAL(sendMessage(int,QString)), core, SLOT(sendGroupMessage(int,QString)));
|
||||||
|
@ -811,12 +751,6 @@ bool Widget::isFriendWidgetCurActiveWidget(Friend* f)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::resizeEvent(QResizeEvent *)
|
|
||||||
{
|
|
||||||
updateFriendListWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Widget::event(QEvent * e)
|
bool Widget::event(QEvent * e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -829,7 +763,7 @@ bool Widget::event(QEvent * e)
|
||||||
}
|
}
|
||||||
else if (e->type() == QEvent::WindowActivate)
|
else if (e->type() == QEvent::WindowActivate)
|
||||||
{
|
{
|
||||||
if (!useNativeTheme)
|
if (!Settings::getInstance().getUseNativeDecoration())
|
||||||
{
|
{
|
||||||
this->setObjectName("activeWindow");
|
this->setObjectName("activeWindow");
|
||||||
this->style()->polish(this);
|
this->style()->polish(this);
|
||||||
|
@ -846,18 +780,18 @@ bool Widget::event(QEvent * e)
|
||||||
Group* g = GroupList::findGroup(activeGroupWidget->groupId);
|
Group* g = GroupList::findGroup(activeGroupWidget->groupId);
|
||||||
g->hasNewMessages = 0;
|
g->hasNewMessages = 0;
|
||||||
g->userWasMentioned = 0;
|
g->userWasMentioned = 0;
|
||||||
if (useNativeTheme)
|
if (Settings::getInstance().getUseNativeDecoration())
|
||||||
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_online.png"));
|
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_online.png"));
|
||||||
else
|
else
|
||||||
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_groupchat.png"));
|
g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_groupchat.png"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (e->type() == QEvent::WindowDeactivate && !useNativeTheme)
|
else if (e->type() == QEvent::WindowDeactivate && !Settings::getInstance().getUseNativeDecoration())
|
||||||
{
|
{
|
||||||
this->setObjectName("inactiveWindow");
|
this->setObjectName("inactiveWindow");
|
||||||
this->style()->polish(this);
|
this->style()->polish(this);
|
||||||
}
|
}
|
||||||
else if (e->type() == QEvent::MouseMove && !useNativeTheme)
|
else if (e->type() == QEvent::MouseMove && !Settings::getInstance().getUseNativeDecoration())
|
||||||
{
|
{
|
||||||
QMouseEvent *k = (QMouseEvent *)e;
|
QMouseEvent *k = (QMouseEvent *)e;
|
||||||
int xMouse = k->pos().x();
|
int xMouse = k->pos().x();
|
||||||
|
@ -902,7 +836,7 @@ bool Widget::event(QEvent * e)
|
||||||
|
|
||||||
void Widget::mousePressEvent(QMouseEvent *e)
|
void Widget::mousePressEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
if (!useNativeTheme)
|
if (!Settings::getInstance().getUseNativeDecoration())
|
||||||
{
|
{
|
||||||
if (e->button() == Qt::LeftButton)
|
if (e->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
|
@ -936,7 +870,7 @@ void Widget::mousePressEvent(QMouseEvent *e)
|
||||||
|
|
||||||
void Widget::mouseReleaseEvent(QMouseEvent *e)
|
void Widget::mouseReleaseEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
if (!useNativeTheme)
|
if (!Settings::getInstance().getUseNativeDecoration())
|
||||||
{
|
{
|
||||||
moveWidget = false;
|
moveWidget = false;
|
||||||
allowToResize = false;
|
allowToResize = false;
|
||||||
|
@ -951,7 +885,7 @@ void Widget::mouseReleaseEvent(QMouseEvent *e)
|
||||||
|
|
||||||
void Widget::mouseDoubleClickEvent(QMouseEvent *e)
|
void Widget::mouseDoubleClickEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
if (!useNativeTheme)
|
if (!Settings::getInstance().getUseNativeDecoration())
|
||||||
{
|
{
|
||||||
if (e->pos().x() < ui->tbMenu->geometry().right() and e->pos().y() < ui->tbMenu->geometry().bottom()
|
if (e->pos().x() < ui->tbMenu->geometry().right() and e->pos().y() < ui->tbMenu->geometry().bottom()
|
||||||
and e->pos().x() >= ui->tbMenu->geometry().x() and e->pos().y() >= ui->tbMenu->geometry().y()
|
and e->pos().x() >= ui->tbMenu->geometry().x() and e->pos().y() >= ui->tbMenu->geometry().y()
|
||||||
|
@ -975,7 +909,7 @@ void Widget::paintEvent (QPaintEvent *)
|
||||||
|
|
||||||
void Widget::moveWindow(QMouseEvent *e)
|
void Widget::moveWindow(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
if (!useNativeTheme)
|
if (!Settings::getInstance().getUseNativeDecoration())
|
||||||
{
|
{
|
||||||
if (e->buttons() & Qt::LeftButton)
|
if (e->buttons() & Qt::LeftButton)
|
||||||
{
|
{
|
||||||
|
@ -987,8 +921,7 @@ void Widget::moveWindow(QMouseEvent *e)
|
||||||
|
|
||||||
void Widget::resizeWindow(QMouseEvent *e)
|
void Widget::resizeWindow(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
updateFriendListWidth();
|
if (!Settings::getInstance().getUseNativeDecoration())
|
||||||
if (!useNativeTheme)
|
|
||||||
{
|
{
|
||||||
if (allowToResize)
|
if (allowToResize)
|
||||||
{
|
{
|
||||||
|
@ -1116,47 +1049,47 @@ void Widget::setTitlebarMode(const TitleMode &flag)
|
||||||
|
|
||||||
switch (m_titleMode)
|
switch (m_titleMode)
|
||||||
{
|
{
|
||||||
case CleanTitle:
|
case CleanTitle:
|
||||||
ui->tbMenu->setHidden(true);
|
ui->tbMenu->setHidden(true);
|
||||||
ui->pbMin->setHidden(true);
|
ui->pbMin->setHidden(true);
|
||||||
ui->pbMax->setHidden(true);
|
ui->pbMax->setHidden(true);
|
||||||
ui->pbClose->setHidden(true);
|
ui->pbClose->setHidden(true);
|
||||||
break;
|
break;
|
||||||
case OnlyCloseButton:
|
case OnlyCloseButton:
|
||||||
ui->tbMenu->setHidden(true);
|
ui->tbMenu->setHidden(true);
|
||||||
ui->pbMin->setHidden(true);
|
ui->pbMin->setHidden(true);
|
||||||
ui->pbMax->setHidden(true);
|
ui->pbMax->setHidden(true);
|
||||||
break;
|
break;
|
||||||
case MenuOff:
|
case MenuOff:
|
||||||
ui->tbMenu->setHidden(true);
|
ui->tbMenu->setHidden(true);
|
||||||
break;
|
break;
|
||||||
case MaxMinOff:
|
case MaxMinOff:
|
||||||
ui->pbMin->setHidden(true);
|
ui->pbMin->setHidden(true);
|
||||||
ui->pbMax->setHidden(true);
|
ui->pbMax->setHidden(true);
|
||||||
break;
|
break;
|
||||||
case FullScreenMode:
|
case FullScreenMode:
|
||||||
ui->pbMax->setHidden(true);
|
ui->pbMax->setHidden(true);
|
||||||
showMaximized();
|
showMaximized();
|
||||||
break;
|
break;
|
||||||
case MaximizeModeOff:
|
case MaximizeModeOff:
|
||||||
ui->pbMax->setHidden(true);
|
ui->pbMax->setHidden(true);
|
||||||
break;
|
break;
|
||||||
case MinimizeModeOff:
|
case MinimizeModeOff:
|
||||||
ui->pbMin->setHidden(true);
|
ui->pbMin->setHidden(true);
|
||||||
break;
|
break;
|
||||||
case FullTitle:
|
case FullTitle:
|
||||||
ui->tbMenu->setVisible(true);
|
ui->tbMenu->setVisible(true);
|
||||||
ui->pbMin->setVisible(true);
|
ui->pbMin->setVisible(true);
|
||||||
ui->pbMax->setVisible(true);
|
ui->pbMax->setVisible(true);
|
||||||
ui->pbClose->setVisible(true);
|
ui->pbClose->setVisible(true);
|
||||||
break;
|
break;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ui->tbMenu->setVisible(true);
|
ui->tbMenu->setVisible(true);
|
||||||
ui->pbMin->setVisible(true);
|
ui->pbMin->setVisible(true);
|
||||||
ui->pbMax->setVisible(true);
|
ui->pbMax->setVisible(true);
|
||||||
ui->pbClose->setVisible(true);
|
ui->pbClose->setVisible(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ui->LTitle->setVisible(true);
|
ui->LTitle->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#define WIDGET_H
|
#define WIDGET_H
|
||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QWidget>
|
#include <QMainWindow>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
#define PIXELS_TO_ACT 7
|
#define PIXELS_TO_ACT 7
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Widget;
|
class MainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupWidget;
|
class GroupWidget;
|
||||||
|
@ -39,7 +39,7 @@ struct FriendWidget;
|
||||||
class Group;
|
class Group;
|
||||||
struct Friend;
|
struct Friend;
|
||||||
|
|
||||||
class Widget : public QWidget
|
class Widget : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -58,9 +58,9 @@ public:
|
||||||
void newMessageAlert();
|
void newMessageAlert();
|
||||||
bool isFriendWidgetCurActiveWidget(Friend* f);
|
bool isFriendWidgetCurActiveWidget(Friend* f);
|
||||||
void updateFriendStatusLights(int friendId);
|
void updateFriendStatusLights(int friendId);
|
||||||
int useNativeTheme;
|
|
||||||
~Widget();
|
~Widget();
|
||||||
void updateFriendListWidth();
|
|
||||||
|
virtual void closeEvent(QCloseEvent *event);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void friendRequestAccepted(const QString& userId);
|
void friendRequestAccepted(const QString& userId);
|
||||||
|
@ -70,9 +70,6 @@ signals:
|
||||||
void usernameChanged(const QString& username);
|
void usernameChanged(const QString& username);
|
||||||
void statusMessageChanged(const QString& statusMessage);
|
void statusMessageChanged(const QString& statusMessage);
|
||||||
|
|
||||||
protected:
|
|
||||||
void resizeEvent(QResizeEvent *);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void maximizeBtnClicked();
|
void maximizeBtnClicked();
|
||||||
void minimizeBtnClicked();
|
void minimizeBtnClicked();
|
||||||
|
@ -108,7 +105,6 @@ private slots:
|
||||||
void removeFriend(int friendId);
|
void removeFriend(int friendId);
|
||||||
void copyFriendIdToClipboard(int friendId);
|
void copyFriendIdToClipboard(int friendId);
|
||||||
void removeGroup(int groupId);
|
void removeGroup(int groupId);
|
||||||
void splitterMoved(int pos, int index);
|
|
||||||
void setStatusOnline();
|
void setStatusOnline();
|
||||||
void setStatusAway();
|
void setStatusAway();
|
||||||
void setStatusBusy();
|
void setStatusBusy();
|
||||||
|
@ -121,7 +117,7 @@ private:
|
||||||
Group* createGroup(int groupId);
|
Group* createGroup(int groupId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Widget *ui;
|
Ui::MainWindow *ui;
|
||||||
QSplitter *centralLayout;
|
QSplitter *centralLayout;
|
||||||
QPoint dragPosition;
|
QPoint dragPosition;
|
||||||
TitleMode m_titleMode;
|
TitleMode m_titleMode;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user