The complete source code of IdealIRC
http://www.idealirc.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.2 KiB
58 lines
1.2 KiB
/*
|
|
* IdealIRC - Internet Relay Chat client
|
|
* Copyright (C) 2021 Tom-Andre Barstad.
|
|
* This software is licensed under the Software Attribution License.
|
|
* See LICENSE for more information.
|
|
*/
|
|
|
|
#include "IWin.h"
|
|
#include <QDateTime>
|
|
|
|
const QString IWin::InvalidWindowTypeString { "Invalid" };
|
|
|
|
std::unordered_map<IWin::Type,QString> IWin::TypeString = {
|
|
{ IWin::Type::Undefined, "Undefined" },
|
|
{ IWin::Type::Status, "Status" },
|
|
{ IWin::Type::Channel, "Channel" },
|
|
{ IWin::Type::Private, "Private" },
|
|
{ IWin::Type::DCCChat, "DCC Chat" },
|
|
{ IWin::Type::Custom, "Custom" }
|
|
};
|
|
|
|
IWin::Type IWin::getType() const
|
|
{
|
|
return m_type;
|
|
}
|
|
|
|
IWin* IWin::getStatusParent()
|
|
{
|
|
return (m_type == Type::Status) ? this : m_parent;
|
|
}
|
|
|
|
bool IWin::print(PrintType ptype, const QString& text)
|
|
{
|
|
const auto timestamp = QDateTime::currentDateTime();
|
|
return printWithCustomTime(timestamp, ptype, text);
|
|
}
|
|
|
|
const QString& IWin::getButtonText() const
|
|
{
|
|
return m_buttonText;
|
|
}
|
|
|
|
void IWin::setButtonText(const QString& text)
|
|
{
|
|
m_buttonText = text;
|
|
}
|
|
|
|
IWin::IWin(Type type, IWin* parentWindow)
|
|
: m_type(type)
|
|
, m_parent(parentWindow)
|
|
{
|
|
|
|
}
|
|
|
|
void IWin::closeEvent(QCloseEvent*)
|
|
{
|
|
emit aboutToClose(this);
|
|
}
|
|
|