This commit is contained in:
Rasmus Karlsson 2019-11-02 12:36:42 +01:00
parent b2d88ba555
commit 0e1f1196d6
5 changed files with 17 additions and 29 deletions

View file

@ -74,7 +74,7 @@ void IrcServerData::getPassword(
QObject *receiver, std::function<void(const QString &)> &&onLoaded) const QObject *receiver, std::function<void(const QString &)> &&onLoaded) const
{ {
Credentials::instance().get("irc", getCredentialName(*this), receiver, Credentials::instance().get("irc", getCredentialName(*this), receiver,
std::move(onLoaded)); std::move(onLoaded));
} }
void IrcServerData::setPassword(const QString &password) void IrcServerData::setPassword(const QString &password)
@ -133,8 +133,7 @@ Irc::Irc()
if (args.caller != Irc::noEraseCredentialCaller) if (args.caller != Irc::noEraseCredentialCaller)
{ {
Credentials::instance().erase("irc", Credentials::instance().erase("irc", getCredentialName(args.item));
getCredentialName(args.item));
} }
}); });

View file

@ -649,8 +649,8 @@ IndirectChannel WindowManager::decodeChannel(const QJsonObject &obj)
} }
else if (type == "irc") else if (type == "irc")
{ {
return Irc::instance().getOrAddChannel( return Irc::instance().getOrAddChannel(obj.value("server").toInt(-1),
obj.value("server").toInt(-1), obj.value("channel").toString()); obj.value("channel").toString());
} }
return Channel::getEmpty(); return Channel::getEmpty();

View file

@ -340,20 +340,17 @@ void BaseWindow::onFocusLost()
{ {
switch (this->getActionOnFocusLoss()) switch (this->getActionOnFocusLoss())
{ {
case Delete: case Delete: {
{
this->deleteLater(); this->deleteLater();
} }
break; break;
case Close: case Close: {
{
this->close(); this->close();
} }
break; break;
case Hide: case Hide: {
{
this->hide(); this->hide();
} }
break; break;

View file

@ -133,8 +133,8 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
auto outerBox = obj.setLayoutType<QFormLayout>(); auto outerBox = obj.setLayoutType<QFormLayout>();
{ {
auto view = this->ui_.irc.servers = new EditableModelView( auto view = this->ui_.irc.servers =
Irc::instance().newConnectionModel(this)); new EditableModelView(Irc::instance().newConnectionModel(this));
view->setTitles({"host", "port", "ssl", "user", "nick", "real", view->setTitles({"host", "port", "ssl", "user", "nick", "real",
"password", "login command"}); "password", "login command"});
@ -166,8 +166,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
if (editor->exec() == QDialog::Accepted) if (editor->exec() == QDialog::Accepted)
{ {
auto data = editor->data(); auto data = editor->data();
auto &&conns = auto &&conns = Irc::instance().connections.getVector();
Irc::instance().connections.getVector();
int i = 0; int i = 0;
for (auto &&conn : conns) for (auto &&conn : conns)
{ {
@ -175,8 +174,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
{ {
Irc::instance().connections.removeItem( Irc::instance().connections.removeItem(
i, Irc::noEraseCredentialCaller); i, Irc::noEraseCredentialCaller);
Irc::instance().connections.insertItem(data, Irc::instance().connections.insertItem(data, i);
i);
} }
i++; i++;
} }

View file

@ -36,19 +36,16 @@ void TitleBarButton::paintEvent(QPaintEvent *event)
switch (this->style_) switch (this->style_)
{ {
case TitleBarButtonStyle::Minimize: case TitleBarButtonStyle::Minimize: {
{
painter.fillRect(centerX - xD / 2, xD * 3 / 2, xD, 1, color); painter.fillRect(centerX - xD / 2, xD * 3 / 2, xD, 1, color);
break; break;
} }
case TitleBarButtonStyle::Maximize: case TitleBarButtonStyle::Maximize: {
{
painter.setPen(color); painter.setPen(color);
painter.drawRect(centerX - xD / 2, xD, xD - 1, xD - 1); painter.drawRect(centerX - xD / 2, xD, xD - 1, xD - 1);
break; break;
} }
case TitleBarButtonStyle::Unmaximize: case TitleBarButtonStyle::Unmaximize: {
{
int xD2 = xD * 1 / 5; int xD2 = xD * 1 / 5;
int xD3 = xD * 4 / 5; int xD3 = xD * 4 / 5;
@ -58,8 +55,7 @@ void TitleBarButton::paintEvent(QPaintEvent *event)
painter.drawRect(centerX - xD / 2, xD + xD2, xD3, xD3); painter.drawRect(centerX - xD / 2, xD + xD2, xD3, xD3);
break; break;
} }
case TitleBarButtonStyle::Close: case TitleBarButtonStyle::Close: {
{
QRect rect(centerX - xD / 2, xD, xD - 1, xD - 1); QRect rect(centerX - xD / 2, xD, xD - 1, xD - 1);
painter.setPen(QPen(color, 1)); painter.setPen(QPen(color, 1));
@ -67,8 +63,7 @@ void TitleBarButton::paintEvent(QPaintEvent *event)
painter.drawLine(rect.topRight(), rect.bottomLeft()); painter.drawLine(rect.topRight(), rect.bottomLeft());
break; break;
} }
case TitleBarButtonStyle::User: case TitleBarButtonStyle::User: {
{
color = "#999"; color = "#999";
painter.setRenderHint(QPainter::Antialiasing); painter.setRenderHint(QPainter::Antialiasing);
@ -94,8 +89,7 @@ void TitleBarButton::paintEvent(QPaintEvent *event)
break; break;
} }
case TitleBarButtonStyle::Settings: case TitleBarButtonStyle::Settings: {
{
color = "#999"; color = "#999";
painter.setRenderHint(QPainter::Antialiasing); painter.setRenderHint(QPainter::Antialiasing);
painter.setRenderHint(QPainter::HighQualityAntialiasing); painter.setRenderHint(QPainter::HighQualityAntialiasing);