commit 10ec77f70aac4144e196298b6f91b47a4c4952f1 Author: Tomatix Date: Mon Jul 13 19:28:42 2020 +0200 Initial commit, pre 1.0.0 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