From 10ec77f70aac4144e196298b6f91b47a4c4952f1 Mon Sep 17 00:00:00 2001 From: Tomatix Date: Mon, 13 Jul 2020 19:28:42 +0200 Subject: [PATCH] Initial commit, pre 1.0.0 --- .gitignore | 20 + AboutIIRC.cpp | 49 + AboutIIRC.h | 41 + AboutIIRC.ui | 105 ++ ButtonbarMgr.cpp | 274 ++++ ButtonbarMgr.h | 77 ++ Commands.h | 93 ++ ConfigMgr.cpp | 294 +++++ ConfigMgr.h | 71 ++ ICommand.cpp | 599 +++++++++ ICommand.h | 39 + ICommand/CommandData.cpp | 50 + ICommand/CommandData.h | 29 + IConfig/ColorConfig.cpp | 373 ++++++ IConfig/ColorConfig.h | 64 + IConfig/IConfig.cpp | 165 +++ IConfig/IConfig.h | 73 ++ IConfig/IConfig.ui | 225 ++++ IConfig/IConfigLogging.cpp | 119 ++ IConfig/IConfigLogging.h | 56 + IConfig/IConfigLogging.ui | 85 ++ IConfig/IConfigOptions.cpp | 175 +++ IConfig/IConfigOptions.h | 74 ++ IConfig/IConfigOptions.ui | 382 ++++++ IConfig/IConfigServers.cpp | 137 ++ IConfig/IConfigServers.h | 62 + IConfig/IConfigServers.ui | 247 ++++ IConfig/ServerEditor.cpp | 325 +++++ IConfig/ServerEditor.h | 71 ++ IConfig/ServerEditor.ui | 251 ++++ IConfig/ServerMgr.cpp | 145 +++ IConfig/ServerMgr.h | 68 + IConfig/ServerModel.cpp | 371 ++++++ IConfig/ServerModel.h | 63 + IConfig/todo/ServerItem.cpp | 137 ++ IConfig/todo/ServerItem.h | 79 ++ IConfig/todo/ServerModel.cpp | 184 +++ IConfig/todo/ServerModel.h | 66 + IRC.cpp | 435 +++++++ IRC.h | 92 ++ IRCClient/Commands.h | 79 ++ IRCClient/DCC.cpp | 207 +++ IRCClient/DCC.h | 73 ++ IRCClient/IRCBase.cpp | 1261 +++++++++++++++++++ IRCClient/IRCBase.h | 152 +++ IRCClient/IRCChannel.cpp | 85 ++ IRCClient/IRCChannel.h | 49 + IRCClient/IRCError.cpp | 105 ++ IRCClient/IRCError.h | 50 + IRCClient/IRCMember.cpp | 43 + IRCClient/IRCMember.h | 30 + IRCClient/IRCMemberEntry.cpp | 55 + IRCClient/IRCMemberEntry.h | 28 + IRCClient/IRCPrefix.cpp | 111 ++ IRCClient/IRCPrefix.h | 52 + IRCClient/Numeric.h | 175 +++ IRCClient/Utilities.cpp | 104 ++ IRCClient/Utilities.h | 14 + IWin/IWin.cpp | 62 + IWin/IWin.h | 70 + IWin/IWinChannel.cpp | 219 ++++ IWin/IWinChannel.h | 76 ++ IWin/IWinPrivate.cpp | 101 ++ IWin/IWinPrivate.h | 54 + IWin/IWinStatus.cpp | 205 +++ IWin/IWinStatus.h | 72 ++ IWin/NicklistController.cpp | 214 ++++ IWin/NicklistController.h | 56 + Icons/add.png | Bin 0 -> 2393 bytes Icons/exclamation.png | Bin 0 -> 1507 bytes Icons/icon.png | Bin 0 -> 40704 bytes Icons/iconcutted.png | Bin 0 -> 45115 bytes Icons/log.png | Bin 0 -> 33375 bytes Icons/options.png | Bin 0 -> 20474 bytes Icons/refresh.png | Bin 0 -> 7072 bytes Icons/remove.png | Bin 0 -> 1898 bytes Icons/script.png | Bin 0 -> 12125 bytes Icons/server.png | Bin 0 -> 13547 bytes IdealIRC.cpp | 282 +++++ IdealIRC.h | 74 ++ IdealIRC.pro | 196 +++ IdealIRC.ui | 175 +++ IniFile.cpp | 539 ++++++++ IniFile.h | 57 + InputHandler.cpp | 80 ++ InputHandler.h | 44 + LICENSE | 339 +++++ MdiManager.cpp | 329 +++++ MdiManager.h | 99 ++ Numeric.h | 194 +++ README | 30 + Script/Builtin/Builtin.cpp | 108 ++ Script/Builtin/Builtin.h | 6 + Script/Builtin/DialogUtils.cpp | 247 ++++ Script/Builtin/DialogUtils.h | 28 + Script/Builtin/Error.cpp | 94 ++ Script/Builtin/Error.h | 20 + Script/Builtin/GeneralUtils.cpp | 167 +++ Script/Builtin/GeneralUtils.h | 23 + Script/Builtin/ListUtils.cpp | 196 +++ Script/Builtin/ListUtils.h | 21 + Script/Builtin/MapUtils.cpp | 75 ++ Script/Builtin/MapUtils.h | 16 + Script/Builtin/Mathematics.cpp | 438 +++++++ Script/Builtin/Mathematics.h | 31 + Script/Builtin/StringUtils.cpp | 246 ++++ Script/Builtin/StringUtils.h | 22 + Script/Dialog.cpp | 199 +++ Script/Dialog.h | 94 ++ Script/Manager.cpp | 316 +++++ Script/Manager.h | 126 ++ Script/Manager.ui | 160 +++ Script/ManagerListModel.cpp | 106 ++ Script/ManagerListModel.h | 29 + Script/Menu.cpp | 162 +++ Script/Menu.h | 71 ++ Script/ParserOperator.h | 26 + Script/ParserToken.cpp | 147 +++ Script/ParserToken.h | 58 + Script/Script.cpp | 1034 +++++++++++++++ Script/Script.h | 86 ++ Script/ScriptException.cpp | 36 + Script/ScriptException.h | 21 + Script/SymbolScope.cpp | 133 ++ Script/SymbolScope.h | 79 ++ Script/Tokenizer.cpp | 1103 ++++++++++++++++ Script/Tokenizer.h | 50 + Script/Tokens.cpp | 494 ++++++++ Script/Tokens.h | 371 ++++++ Script/ValueExtract.cpp | 77 ++ Script/ValueExtract.h | 28 + Script/ValueHolder.cpp | 825 ++++++++++++ Script/ValueHolder.h | 131 ++ Script/main.cpp | 155 +++ ScriptDialog/ScriptDialog.cpp | 1144 +++++++++++++++++ ScriptDialog/ScriptDialog.h | 50 + ScriptEvent.h | 27 + ScriptFunctions/RegisterScriptFunctions.cpp | 24 + ScriptFunctions/RegisterScriptFunctions.h | 6 + ScriptFunctions/ScriptGeneralUtils.cpp | 181 +++ ScriptFunctions/ScriptGeneralUtils.h | 18 + ScriptFunctions/ScriptIRCUtils.cpp | 49 + ScriptFunctions/ScriptIRCUtils.h | 14 + Widgets/IIRCView.cpp | 502 ++++++++ Widgets/IIRCView.h | 112 ++ Widgets/ILineEdit.cpp | 91 ++ Widgets/ILineEdit.h | 42 + Widgets/IListWidget.cpp | 26 + Widgets/IListWidget.h | 15 + config.h.in | 77 ++ events.txt | 28 + main.cpp | 33 + resources.qrc | 14 + 153 files changed, 22813 insertions(+) create mode 100644 .gitignore create mode 100644 AboutIIRC.cpp create mode 100644 AboutIIRC.h create mode 100644 AboutIIRC.ui create mode 100644 ButtonbarMgr.cpp create mode 100644 ButtonbarMgr.h create mode 100644 Commands.h create mode 100644 ConfigMgr.cpp create mode 100644 ConfigMgr.h create mode 100644 ICommand.cpp create mode 100644 ICommand.h create mode 100644 ICommand/CommandData.cpp create mode 100644 ICommand/CommandData.h create mode 100644 IConfig/ColorConfig.cpp create mode 100644 IConfig/ColorConfig.h create mode 100644 IConfig/IConfig.cpp create mode 100644 IConfig/IConfig.h create mode 100644 IConfig/IConfig.ui create mode 100644 IConfig/IConfigLogging.cpp create mode 100644 IConfig/IConfigLogging.h create mode 100644 IConfig/IConfigLogging.ui create mode 100644 IConfig/IConfigOptions.cpp create mode 100644 IConfig/IConfigOptions.h create mode 100644 IConfig/IConfigOptions.ui create mode 100644 IConfig/IConfigServers.cpp create mode 100644 IConfig/IConfigServers.h create mode 100644 IConfig/IConfigServers.ui create mode 100644 IConfig/ServerEditor.cpp create mode 100644 IConfig/ServerEditor.h create mode 100644 IConfig/ServerEditor.ui create mode 100644 IConfig/ServerMgr.cpp create mode 100644 IConfig/ServerMgr.h create mode 100644 IConfig/ServerModel.cpp create mode 100644 IConfig/ServerModel.h create mode 100644 IConfig/todo/ServerItem.cpp create mode 100644 IConfig/todo/ServerItem.h create mode 100644 IConfig/todo/ServerModel.cpp create mode 100644 IConfig/todo/ServerModel.h create mode 100644 IRC.cpp create mode 100644 IRC.h create mode 100644 IRCClient/Commands.h create mode 100644 IRCClient/DCC.cpp create mode 100644 IRCClient/DCC.h create mode 100644 IRCClient/IRCBase.cpp create mode 100644 IRCClient/IRCBase.h create mode 100644 IRCClient/IRCChannel.cpp create mode 100644 IRCClient/IRCChannel.h create mode 100644 IRCClient/IRCError.cpp create mode 100644 IRCClient/IRCError.h create mode 100644 IRCClient/IRCMember.cpp create mode 100644 IRCClient/IRCMember.h create mode 100644 IRCClient/IRCMemberEntry.cpp create mode 100644 IRCClient/IRCMemberEntry.h create mode 100644 IRCClient/IRCPrefix.cpp create mode 100644 IRCClient/IRCPrefix.h create mode 100644 IRCClient/Numeric.h create mode 100644 IRCClient/Utilities.cpp create mode 100644 IRCClient/Utilities.h create mode 100644 IWin/IWin.cpp create mode 100644 IWin/IWin.h create mode 100644 IWin/IWinChannel.cpp create mode 100644 IWin/IWinChannel.h create mode 100644 IWin/IWinPrivate.cpp create mode 100644 IWin/IWinPrivate.h create mode 100644 IWin/IWinStatus.cpp create mode 100644 IWin/IWinStatus.h create mode 100644 IWin/NicklistController.cpp create mode 100644 IWin/NicklistController.h create mode 100644 Icons/add.png create mode 100644 Icons/exclamation.png create mode 100644 Icons/icon.png create mode 100644 Icons/iconcutted.png create mode 100644 Icons/log.png create mode 100644 Icons/options.png create mode 100644 Icons/refresh.png create mode 100644 Icons/remove.png create mode 100644 Icons/script.png create mode 100644 Icons/server.png create mode 100644 IdealIRC.cpp create mode 100644 IdealIRC.h create mode 100644 IdealIRC.pro create mode 100644 IdealIRC.ui create mode 100644 IniFile.cpp create mode 100644 IniFile.h create mode 100644 InputHandler.cpp create mode 100644 InputHandler.h create mode 100644 LICENSE create mode 100644 MdiManager.cpp create mode 100644 MdiManager.h create mode 100644 Numeric.h create mode 100644 README create mode 100644 Script/Builtin/Builtin.cpp create mode 100644 Script/Builtin/Builtin.h create mode 100644 Script/Builtin/DialogUtils.cpp create mode 100644 Script/Builtin/DialogUtils.h create mode 100644 Script/Builtin/Error.cpp create mode 100644 Script/Builtin/Error.h create mode 100644 Script/Builtin/GeneralUtils.cpp create mode 100644 Script/Builtin/GeneralUtils.h create mode 100644 Script/Builtin/ListUtils.cpp create mode 100644 Script/Builtin/ListUtils.h create mode 100644 Script/Builtin/MapUtils.cpp create mode 100644 Script/Builtin/MapUtils.h create mode 100644 Script/Builtin/Mathematics.cpp create mode 100644 Script/Builtin/Mathematics.h create mode 100644 Script/Builtin/StringUtils.cpp create mode 100644 Script/Builtin/StringUtils.h create mode 100644 Script/Dialog.cpp create mode 100644 Script/Dialog.h create mode 100644 Script/Manager.cpp create mode 100644 Script/Manager.h create mode 100644 Script/Manager.ui create mode 100644 Script/ManagerListModel.cpp create mode 100644 Script/ManagerListModel.h create mode 100644 Script/Menu.cpp create mode 100644 Script/Menu.h create mode 100644 Script/ParserOperator.h create mode 100644 Script/ParserToken.cpp create mode 100644 Script/ParserToken.h create mode 100644 Script/Script.cpp create mode 100644 Script/Script.h create mode 100644 Script/ScriptException.cpp create mode 100644 Script/ScriptException.h create mode 100644 Script/SymbolScope.cpp create mode 100644 Script/SymbolScope.h create mode 100644 Script/Tokenizer.cpp create mode 100644 Script/Tokenizer.h create mode 100644 Script/Tokens.cpp create mode 100644 Script/Tokens.h create mode 100644 Script/ValueExtract.cpp create mode 100644 Script/ValueExtract.h create mode 100644 Script/ValueHolder.cpp create mode 100644 Script/ValueHolder.h create mode 100644 Script/main.cpp create mode 100644 ScriptDialog/ScriptDialog.cpp create mode 100644 ScriptDialog/ScriptDialog.h create mode 100644 ScriptEvent.h create mode 100644 ScriptFunctions/RegisterScriptFunctions.cpp create mode 100644 ScriptFunctions/RegisterScriptFunctions.h create mode 100644 ScriptFunctions/ScriptGeneralUtils.cpp create mode 100644 ScriptFunctions/ScriptGeneralUtils.h create mode 100644 ScriptFunctions/ScriptIRCUtils.cpp create mode 100644 ScriptFunctions/ScriptIRCUtils.h create mode 100644 Widgets/IIRCView.cpp create mode 100644 Widgets/IIRCView.h create mode 100644 Widgets/ILineEdit.cpp create mode 100644 Widgets/ILineEdit.h create mode 100644 Widgets/IListWidget.cpp create mode 100644 Widgets/IListWidget.h create mode 100644 config.h.in create mode 100644 events.txt create mode 100644 main.cpp create mode 100644 resources.qrc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d17759f --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +*.slo +*.lo +*.o +*.a +*.la +*.lai +*.so +*.dll +*.dylib +*.pro.user +*.pro.user.* +moc_*.cpp +qrc_*.cpp +Makefile +*-build-* +build +config.h +*.autosave +.idea +obsolete diff --git a/AboutIIRC.cpp b/AboutIIRC.cpp new file mode 100644 index 0000000..c68db16 --- /dev/null +++ b/AboutIIRC.cpp @@ -0,0 +1,49 @@ +/* + * IdealIRC - Internet Relay Chat client + * Copyright (C) 2019 Tom-Andre Barstad + * + * 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 2 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "AboutIIRC.h" +#include "ui_AboutIIRC.h" +#include "config.h" +#include + +AboutIIRC::AboutIIRC(QWidget *parent) : + QDialog(parent), + ui(new Ui::AboutIIRC) +{ + ui->setupUi(this); + + QDateTime cur = QDateTime::currentDateTime(); + QString year = QString::number(cur.date().year()); + + QString text = ui->textBrowser->toHtml(); + text = text.replace("{year}", year); + text = text.replace("{ver}", VERSION_STRING); + + if constexpr (BUILD_TYPE == BuildType::packaged) + text = text.replace("{buildtype}", QStringLiteral("Packaged")); + else if constexpr (BUILD_TYPE == BuildType::standalone) + text = text.replace("{buildtype}", QStringLiteral("Stand-alone")); + + ui->textBrowser->setHtml(text); +} + +AboutIIRC::~AboutIIRC() +{ + delete ui; +} diff --git a/AboutIIRC.h b/AboutIIRC.h new file mode 100644 index 0000000..df1e34e --- /dev/null +++ b/AboutIIRC.h @@ -0,0 +1,41 @@ +/* + * IdealIRC - Internet Relay Chat client + * Copyright (C) 2019 Tom-Andre Barstad + * + * 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 2 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#ifndef ABOUTIIRC_H +#define ABOUTIIRC_H + +#include + +namespace Ui { +class AboutIIRC; +} + +class AboutIIRC : public QDialog +{ + Q_OBJECT + +public: + explicit AboutIIRC(QWidget *parent = nullptr); + ~AboutIIRC(); + +private: + Ui::AboutIIRC *ui; +}; + +#endif // ABOUTIIRC_H diff --git a/AboutIIRC.ui b/AboutIIRC.ui new file mode 100644 index 0000000..ed06676 --- /dev/null +++ b/AboutIIRC.ui @@ -0,0 +1,105 @@ + + + AboutIIRC + + + + 0 + 0 + 425 + 490 + + + + + 425 + 490 + + + + + 425 + 490 + + + + About IdealIRC + + + + :/Icons/iconcutted.png:/Icons/iconcutted.png + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/Icons/icon.png" /></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:16pt;">IdealIRC {ver}</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans';">Build type: {buildtype}</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:10pt;">©{year} Tom-Andre Barstad</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:10pt;">and contributors.</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.idealirc.org/"><span style=" font-family:'Sans'; font-size:8pt; text-decoration: underline; color:#007af4;">http://www.idealirc.org/</span></a></p> +<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Noto Sans'; font-size:8pt;"><br /></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:8pt;">This program is free software; you can redistribute it and/or modify</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:8pt;">it under the terms of the GNU General Public License as published by</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:8pt;">the Free Software Foundation; either version 2 of the License, or</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:8pt;">(at your option) any later version.</span></p> +<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Noto Sans'; font-size:8pt;"><br /></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:8pt;">This program is distributed in the hope that it will be useful,</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:8pt;">but WITHOUT ANY WARRANTY; without even the implied warranty of</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:8pt;">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:8pt;">GNU General Public License for more details.</span></p></body></html> + + + true + + + + + + + Qt::Horizontal + + + + 439 + 20 + + + + + + + + Close + + + + + + + + + + + pushButton + clicked() + AboutIIRC + close() + + + 466 + 452 + + + 430 + 444 + + + + + diff --git a/ButtonbarMgr.cpp b/ButtonbarMgr.cpp new file mode 100644 index 0000000..40507f4 --- /dev/null +++ b/ButtonbarMgr.cpp @@ -0,0 +1,274 @@ +#include "ButtonbarMgr.h" + +int ButtonbarMgr::WindowTypeToGroupPos(const IWin* subwin) +{ + switch (subwin->getType()) { + case IWin::Type::Status: + return 1; + case IWin::Type::Channel: + return 2; + case IWin::Type::Private: + return 3; + default: + return 0; + } +} + +ButtonbarMgr::ButtonbarMgr(QToolBar *parent) + : QObject(parent) + , m_buttonBar(*parent) +{ + m_buttonBar.setContextMenuPolicy(Qt::CustomContextMenu); + connect(&m_buttonBar, &QToolBar::customContextMenuRequested, this, &ButtonbarMgr::buttonBarContextMenu); + m_others_rightSep = m_buttonBar.addSeparator(); +} + +void ButtonbarMgr::addButton(IWin* subwin, QMdiSubWindow* mdiwin) +{ + QAction* nn = findNextNeighbour(subwin); + QAction *actn = new QAction(subwin->getButtonText(), &m_buttonBar); + m_buttonBar.insertAction(nn, actn); + m_winbtn.insert(subwin, actn); + actn->setCheckable(true); + buttons(subwin).push_back(Button(actn, mdiwin)); + connect(actn, &QAction::triggered, [this,actn,mdiwin](bool triggered){ + if (!triggered) { + actn->setChecked(true); + return; + } + emit changeWindow(mdiwin); + }); +} + +void ButtonbarMgr::delButton(IWin* subwin) +{ + auto clear = [this](Button& button){ + m_buttonBar.removeAction(button.button); + button.menu->deleteLater(); + button.button->deleteLater(); + }; + + m_winbtn.remove(subwin); + if (subwin->getType() != IWin::Type::Status + && subwin->getType() != IWin::Type::Channel + && subwin->getType() != IWin::Type::Private) + { + int otherPos = buttonPosition(m_others, subwin); + if (otherPos > -1) { + clear(m_others[otherPos]); + m_others.removeAt(otherPos); + } + return; + } + + if (subwin->getType() == IWin::Type::Status) { + deleteGroup(subwin); + return; + } + + ButtonGroup* group = tryFindGroup(subwin); + if (!group) { + return; + } + + for (int i = 0; i < group->size; ++i) { + QList