-namespace Ui {class MainWindow;}
+class ContentLayout;
class AddFriendForm : public QObject
{
@@ -37,7 +37,8 @@ public:
AddFriendForm& operator=(const AddFriendForm&) = delete;
~AddFriendForm();
- void show(Ui::MainWindow &ui);
+ bool isShown() const;
+ void show(ContentLayout* contentLayout);
QString getMessage() const;
signals:
diff --git a/src/widget/form/chatform.cpp b/src/widget/form/chatform.cpp
index bc43b1674..2a11fb63c 100644
--- a/src/widget/form/chatform.cpp
+++ b/src/widget/form/chatform.cpp
@@ -216,13 +216,7 @@ void ChatForm::onFileRecvRequest(ToxFile file)
if (file.friendId != f->getFriendID())
return;
- Widget* w = Widget::getInstance();
- if (!w->isFriendWidgetCurActiveWidget(f)|| w->isMinimized() || !w->isActiveWindow())
- {
- w->newMessageAlert(f->getFriendWidget());
- f->setEventFlag(true);
- f->getFriendWidget()->updateStatusLight();
- }
+ Widget::getInstance()->newFriendMessageAlert(file.friendId);
QString name;
ToxId friendId = f->getToxId();
@@ -265,7 +259,7 @@ void ChatForm::onAvInvite(uint32_t FriendId, int CallId, bool video)
if (video)
{
callConfirm = new CallConfirmWidget(videoButton, *f);
- if (Widget::getInstance()->isFriendWidgetCurActiveWidget(f))
+ if (f->getFriendWidget()->chatFormIsSet(false))
callConfirm->show();
connect(callConfirm, &CallConfirmWidget::accepted, this, &ChatForm::onAnswerCallTriggered);
@@ -280,7 +274,7 @@ void ChatForm::onAvInvite(uint32_t FriendId, int CallId, bool video)
else
{
callConfirm = new CallConfirmWidget(callButton, *f);
- if (Widget::getInstance()->isFriendWidgetCurActiveWidget(f))
+ if (f->getFriendWidget()->chatFormIsSet(false))
callConfirm->show();
connect(callConfirm, &CallConfirmWidget::accepted, this, &ChatForm::onAnswerCallTriggered);
@@ -292,6 +286,7 @@ void ChatForm::onAvInvite(uint32_t FriendId, int CallId, bool video)
videoButton->setToolTip("");
connect(callButton, &QPushButton::clicked, this, &ChatForm::onAnswerCallTriggered);
}
+
callButton->style()->polish(callButton);
videoButton->style()->polish(videoButton);
@@ -299,13 +294,7 @@ void ChatForm::onAvInvite(uint32_t FriendId, int CallId, bool video)
ChatMessage::INFO,
QDateTime::currentDateTime()));
- Widget* w = Widget::getInstance();
- if (!w->isFriendWidgetCurActiveWidget(f)|| w->isMinimized() || !w->isActiveWindow())
- {
- w->newMessageAlert(f->getFriendWidget());
- f->setEventFlag(true);
- f->getFriendWidget()->updateStatusLight();
- }
+ Widget::getInstance()->newFriendMessageAlert(FriendId);
}
void ChatForm::onAvStart(uint32_t FriendId, int CallId, bool video)
@@ -1009,9 +998,9 @@ void ChatForm::setFriendTyping(bool isTyping)
text->setText("" + QString("%1 is typing").arg(f->getDisplayedName()) + "
");
}
-void ChatForm::show(Ui::MainWindow &ui)
+void ChatForm::show(ContentLayout* contentLayout)
{
- GenericChatForm::show(ui);
+ GenericChatForm::show(contentLayout);
if (callConfirm)
callConfirm->show();
diff --git a/src/widget/form/chatform.h b/src/widget/form/chatform.h
index 2aaf72f04..e2bfd2c49 100644
--- a/src/widget/form/chatform.h
+++ b/src/widget/form/chatform.h
@@ -27,7 +27,6 @@
#include
#include
-
class Friend;
class FileTransferInstance;
class NetCamView;
@@ -50,7 +49,7 @@ public:
void setFriendTyping(bool isTyping);
OfflineMsgEngine* getOfflineMsgEngine();
- virtual void show(Ui::MainWindow &ui) final override;
+ virtual void show(ContentLayout* contentLayout) final override;
signals:
void sendFile(uint32_t friendId, QString, QString, long long);
diff --git a/src/widget/form/filesform.cpp b/src/widget/form/filesform.cpp
index 623b330e9..61c1f949f 100644
--- a/src/widget/form/filesform.cpp
+++ b/src/widget/form/filesform.cpp
@@ -18,10 +18,11 @@
*/
#include "filesform.h"
-#include "ui_mainwindow.h"
#include "src/widget/widget.h"
#include "src/widget/translator.h"
+#include "src/widget/contentlayout.h"
#include
+#include
FilesForm::FilesForm()
: QObject(), doneIcon(":/ui/fileTransferWidget/fileDone.svg")
@@ -54,10 +55,21 @@ FilesForm::~FilesForm()
head->deleteLater();
}
-void FilesForm::show(Ui::MainWindow& ui)
+bool FilesForm::isShown() const
{
- ui.mainContent->layout()->addWidget(&main);
- ui.mainHead->layout()->addWidget(head);
+ if (main.isVisible())
+ {
+ head->window()->windowHandle()->alert(0);
+ return true;
+ }
+
+ return false;
+}
+
+void FilesForm::show(ContentLayout* contentLayout)
+{
+ contentLayout->mainContent->layout()->addWidget(&main);
+ contentLayout->mainHead->layout()->addWidget(head);
main.show();
head->show();
}
diff --git a/src/widget/form/filesform.h b/src/widget/form/filesform.h
index cc523def2..bb18dc41b 100644
--- a/src/widget/form/filesform.h
+++ b/src/widget/form/filesform.h
@@ -26,7 +26,7 @@
#include
#include
-namespace Ui {class MainWindow;}
+class ContentLayout;
class QListWidget;
class FilesForm : public QObject
@@ -37,7 +37,8 @@ public:
FilesForm();
~FilesForm();
- void show(Ui::MainWindow &ui);
+ bool isShown() const;
+ void show(ContentLayout* contentLayout);
public slots:
void onFileDownloadComplete(const QString& path);
diff --git a/src/widget/form/genericchatform.cpp b/src/widget/form/genericchatform.cpp
index 4b2a4f47e..21c9f0c51 100644
--- a/src/widget/form/genericchatform.cpp
+++ b/src/widget/form/genericchatform.cpp
@@ -18,7 +18,6 @@
*/
#include "genericchatform.h"
-#include "ui_mainwindow.h"
#include
#include
@@ -42,6 +41,9 @@
#include "src/chatlog/content/timestamp.h"
#include "src/widget/tool/flyoutoverlaywidget.h"
#include "src/widget/translator.h"
+#include "src/widget/contentlayout.h"
+#include "src/widget/tool/croppinglabel.h"
+#include
GenericChatForm::GenericChatForm(QWidget *parent)
: QWidget(parent)
@@ -255,10 +257,10 @@ void GenericChatForm::setName(const QString &newName)
nameLabel->setToolTip(newName); // for overlength names
}
-void GenericChatForm::show(Ui::MainWindow &ui)
+void GenericChatForm::show(ContentLayout* contentLayout)
{
- ui.mainContent->layout()->addWidget(this);
- ui.mainHead->layout()->addWidget(headWidget);
+ contentLayout->mainContent->layout()->addWidget(this);
+ contentLayout->mainHead->layout()->addWidget(headWidget);
headWidget->show();
QWidget::show();
}
diff --git a/src/widget/form/genericchatform.h b/src/widget/form/genericchatform.h
index 573d6757a..237afdc03 100644
--- a/src/widget/form/genericchatform.h
+++ b/src/widget/form/genericchatform.h
@@ -40,10 +40,7 @@ class ChatLog;
class MaskablePixmapWidget;
class Widget;
class FlyoutOverlayWidget;
-
-namespace Ui {
- class MainWindow;
-}
+class ContentLayout;
class GenericChatForm : public QWidget
{
@@ -54,7 +51,7 @@ public:
void setName(const QString &newName);
virtual void show() final{}
- virtual void show(Ui::MainWindow &ui);
+ virtual void show(ContentLayout* contentLayout);
ChatMessage::Ptr addMessage(const ToxId& author, const QString &message, bool isAction, const QDateTime &datetime, bool isSent);
ChatMessage::Ptr addSelfMessage(const QString &message, bool isAction, const QDateTime &datetime, bool isSent);
diff --git a/src/widget/form/profileform.cpp b/src/widget/form/profileform.cpp
index 051a1b8e7..4954760cb 100644
--- a/src/widget/form/profileform.cpp
+++ b/src/widget/form/profileform.cpp
@@ -21,11 +21,11 @@
#include "src/nexus.h"
#include "ui_profileform.h"
#include "profileform.h"
-#include "ui_mainwindow.h"
#include "src/widget/form/settingswidget.h"
#include "src/widget/maskablepixmapwidget.h"
#include "src/widget/form/setpassworddialog.h"
#include "src/persistence/settings.h"
+#include "src/widget/contentlayout.h"
#include "src/widget/tool/croppinglabel.h"
#include "src/widget/widget.h"
#include "src/widget/gui.h"
@@ -44,6 +44,7 @@
#include
#include
#include
+#include
ProfileForm::ProfileForm(QWidget *parent) :
QWidget{parent}, qr{nullptr}
@@ -134,10 +135,21 @@ ProfileForm::~ProfileForm()
head->deleteLater();
}
-void ProfileForm::show(Ui::MainWindow &ui)
+bool ProfileForm::isShown() const
{
- ui.mainHead->layout()->addWidget(head);
- ui.mainContent->layout()->addWidget(this);
+ if (head->isVisible())
+ {
+ window()->windowHandle()->alert(0);
+ return true;
+ }
+
+ return false;
+}
+
+void ProfileForm::show(ContentLayout* contentLayout)
+{
+ contentLayout->mainHead->layout()->addWidget(head);
+ contentLayout->mainContent->layout()->addWidget(this);
head->show();
QWidget::show();
prFileLabelUpdate();
diff --git a/src/widget/form/profileform.h b/src/widget/form/profileform.h
index db3c87068..cc995e154 100644
--- a/src/widget/form/profileform.h
+++ b/src/widget/form/profileform.h
@@ -30,10 +30,10 @@
class CroppingLabel;
class Core;
class MaskablePixmapWidget;
+class ContentLayout;
namespace Ui {
class IdentitySettings;
-class MainWindow;
}
class ClickableTE : public QLineEdit
@@ -54,7 +54,8 @@ public:
ProfileForm(QWidget *parent = nullptr);
~ProfileForm();
virtual void show() final{}
- void show(Ui::MainWindow &ui);
+ void show(ContentLayout* contentLayout);
+ bool isShown() const;
signals:
void userNameChanged(QString);
diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp
index 27dcf2b2e..7e552fd85 100644
--- a/src/widget/form/settings/generalform.cpp
+++ b/src/widget/form/settings/generalform.cpp
@@ -87,6 +87,9 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
bodyUI->groupAlwaysNotify->setChecked(Settings::getInstance().getGroupAlwaysNotify());
bodyUI->cbFauxOfflineMessaging->setChecked(Settings::getInstance().getFauxOfflineMessaging());
bodyUI->cbCompactLayout->setChecked(Settings::getInstance().getCompactLayout());
+ bodyUI->cbSeparateWindow->setChecked(Settings::getInstance().getSeparateWindow());
+ bodyUI->cbDontGroupWindows->setChecked(Settings::getInstance().getDontGroupWindows());
+ bodyUI->cbDontGroupWindows->setEnabled(bodyUI->cbSeparateWindow->isChecked());
bodyUI->cbGroupchatPosition->setChecked(Settings::getInstance().getGroupchatPosition());
for (auto entry : SmileyPack::listSmileyPacks())
@@ -179,6 +182,8 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
connect(bodyUI->reconnectButton, &QPushButton::clicked, this, &GeneralForm::onReconnectClicked);
connect(bodyUI->cbFauxOfflineMessaging, &QCheckBox::stateChanged, this, &GeneralForm::onFauxOfflineMessaging);
connect(bodyUI->cbCompactLayout, &QCheckBox::stateChanged, this, &GeneralForm::onCompactLayout);
+ connect(bodyUI->cbSeparateWindow, &QCheckBox::stateChanged, this, &GeneralForm::onSeparateWindowChanged);
+ connect(bodyUI->cbDontGroupWindows, &QCheckBox::stateChanged, this, &GeneralForm::onDontGroupWindowsChanged);
connect(bodyUI->cbGroupchatPosition, &QCheckBox::stateChanged, this, &GeneralForm::onGroupchatPositionChanged);
// prevent stealing mouse whell scroll
@@ -430,6 +435,18 @@ void GeneralForm::onCompactLayout()
emit parent->compactToggled(bodyUI->cbCompactLayout->isChecked());
}
+void GeneralForm::onSeparateWindowChanged()
+{
+ bodyUI->cbDontGroupWindows->setEnabled(bodyUI->cbSeparateWindow->isChecked());
+ Settings::getInstance().setSeparateWindow(bodyUI->cbSeparateWindow->isChecked());
+ emit parent->separateWindowToggled(bodyUI->cbSeparateWindow->isChecked());
+}
+
+void GeneralForm::onDontGroupWindowsChanged()
+{
+ Settings::getInstance().setDontGroupWindows(bodyUI->cbDontGroupWindows->isChecked());
+}
+
void GeneralForm::onGroupchatPositionChanged()
{
Settings::getInstance().setGroupchatPosition(bodyUI->cbGroupchatPosition->isChecked());
diff --git a/src/widget/form/settings/generalform.h b/src/widget/form/settings/generalform.h
index 4f53c70c1..74fc7e19f 100644
--- a/src/widget/form/settings/generalform.h
+++ b/src/widget/form/settings/generalform.h
@@ -67,6 +67,8 @@ private slots:
void onSetGroupAlwaysNotify();
void onFauxOfflineMessaging();
void onCompactLayout();
+ void onSeparateWindowChanged();
+ void onDontGroupWindowsChanged();
void onGroupchatPositionChanged();
void onThemeColorChanged(int);
diff --git a/src/widget/form/settings/generalsettings.ui b/src/widget/form/settings/generalsettings.ui
index 81884fe90..8cc7b04f0 100644
--- a/src/widget/form/settings/generalsettings.ui
+++ b/src/widget/form/settings/generalsettings.ui
@@ -40,7 +40,7 @@
0
0
639
- 1221
+ 1388