Commit e4bd6475 authored by Rafał Malinowski's avatar Rafał Malinowski

gui: #2767 fixed: new look for "Add group" window

Signed-off-by: Rafał Malinowski's avatarRafał Przemysław Malinowski <rafal.przemyslaw.malinowski@gmail.com>
parent 476a52e3
......@@ -8,6 +8,7 @@
* encryption_ng: #2952 implemented: add depreceation message (Vogel)
* gadu: #2241 implemented: update contact's avatars on GG event (Vogel)
* gui: #2944 fixed: proper behavior with different combination of window title blinking and new message count included in title (Vogel)
* gui: #2767 fixed: new look for "Add group" window (Vogel)
+++ version 2.0
* unity: #2699 fixed: force indicator_docking on Unity (Vogel)
......
......@@ -132,6 +132,33 @@ Group GroupManager::byName(const QString &name, bool create)
return group;
}
QString GroupManager::validateGroupName(Group group, const QString &newName)
{
if (newName.isEmpty())
return tr("Group name must not be empty");
if (newName.contains(","))
return tr("Group name must not contain '%1'").arg(',');
if (newName.contains(";"))
return tr("Group name must not contain '%1'").arg(';');
bool number;
newName.toLong(&number);
if (number)
return tr("Group name must not be a number");
// TODO All translations
if (newName == tr("All"))
return tr("Group name must not be '%1'").arg(newName);
auto existing = byName(newName, false);
if (existing && existing != group)
return tr("Group '%1' already exists").arg(newName);
return QString{};
}
// TODO: move some of this to %like-encoding, so we don't block normal names
bool GroupManager::acceptableGroupName(const QString &groupName, bool acceptExistingGroupName)
{
......
......@@ -65,6 +65,7 @@ public:
Group byName(const QString &name, bool create = true);
QString validateGroupName(Group group, const QString &newName);
bool acceptableGroupName(const QString &groupName, bool acceptExistingGroupName = false);
signals:
......
......@@ -45,8 +45,8 @@ GroupShared * GroupShared::loadFromStorage(const std::shared_ptr<StoragePoint> &
GroupShared::GroupShared(const QUuid &uuid) :
Shared(uuid),
NotifyAboutStatusChanges(false), ShowInAllGroup(false),
OfflineToGroup(false), ShowIcon(false), ShowName(false),
NotifyAboutStatusChanges(true), ShowInAllGroup(true),
OfflineToGroup(false), ShowIcon(false), ShowName(true),
TabPosition(-1)
{
connect(&changeNotifier(), SIGNAL(changed()), this, SIGNAL(updated()));
......
......@@ -171,8 +171,6 @@ set (gui_SRCS
widgets/configuration/notify-group-box.cpp
widgets/configuration/notify-tree-widget.cpp
widgets/dialog/add-group-dialog-widget.cpp
widgets/dialog/edit-group-dialog-widget.cpp
widgets/dialog/merge-buddies-dialog-widget.cpp
widgets/dialog/password-dialog-widget.cpp
widgets/dialog/title-widget.cpp
......@@ -197,7 +195,7 @@ set (gui_SRCS
windows/chat-data-window.cpp
windows/chat-data-window-repository.cpp
windows/configuration-window.cpp
windows/group-properties-window.cpp
windows/group-edit-window.cpp
windows/kadu-dialog.cpp
windows/kadu-window.cpp
windows/kadu-window-actions.cpp
......@@ -357,8 +355,6 @@ set (gui_MOC_SRCS
widgets/configuration/notifier-configuration-widget.h
widgets/configuration/notify-group-box.h
widgets/dialog/add-group-dialog-widget.h
widgets/dialog/edit-group-dialog-widget.h
widgets/dialog/dialog-widget.h
widgets/dialog/merge-buddies-dialog-widget.h
widgets/dialog/password-dialog-widget.h
......@@ -374,7 +370,6 @@ set (gui_MOC_SRCS
windows/chat-data-window.h
windows/chat-data-window-repository.h
windows/configuration-window.h
windows/group-properties-window.h
windows/kadu-dialog.h
windows/kadu-window.h
windows/kadu-window-actions.h
......
/*
* %kadu copyright begin%
* Copyright 2012 Wojciech Treter (juzefwt@gmail.com)
* Copyright 2013, 2014 Bartosz Brachaczek (b.brachaczek@gmail.com)
* Copyright 2013, 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
* %kadu copyright end%
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#include <QtGui/QIcon>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include "buddies/group-manager.h"
#include "icons/kadu-icon.h"
#include "add-group-dialog-widget.h"
AddGroupDialogWidget::AddGroupDialogWidget(const QString &message, QWidget *parent) :
DialogWidget(tr("Add Group"), message, QPixmap(), parent)
{
QIcon icon = KaduIcon("kadu_icons/kadu").icon();
Pixmap = icon.pixmap(icon.actualSize(QSize(64, 64)));
createGui();
}
AddGroupDialogWidget::~AddGroupDialogWidget()
{
}
void AddGroupDialogWidget::createGui()
{
formLayout = new QFormLayout(this);
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
GroupName = new QLineEdit(this);
GroupName->setFocus();
connect(GroupName, SIGNAL(textChanged(const QString &)), this, SLOT(groupNameTextChanged(const QString &)));
QLabel *addGroupLabel = new QLabel(tr("Group Name") + ":", this);
formLayout->addRow(addGroupLabel, GroupName);
setLayout(formLayout);
}
void AddGroupDialogWidget::groupNameTextChanged(const QString& text)
{
emit valid(GroupManager::instance()->acceptableGroupName(text));
}
void AddGroupDialogWidget::dialogAccepted()
{
QString newGroupName = GroupName->text();
if (!newGroupName.isEmpty() && GroupManager::instance()->acceptableGroupName(newGroupName))
GroupManager::instance()->byName(newGroupName);
}
void AddGroupDialogWidget::dialogRejected()
{
}
#include "moc_add-group-dialog-widget.cpp"
/*
* %kadu copyright begin%
* Copyright 2012 Wojciech Treter (juzefwt@gmail.com)
* Copyright 2014 Bartosz Brachaczek (b.brachaczek@gmail.com)
* Copyright 2013, 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
* %kadu copyright end%
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef ADD_GROUP_DIALOG_WIDGET_H
#define ADD_GROUP_DIALOG_WIDGET_H
#include <QtCore/QVariant>
#include <QtWidgets/QDialog>
#include "gui/widgets/dialog/dialog-widget.h"
class QCheckBox;
class QLineEdit;
class QFormLayout;
class AddGroupDialogWidget : public DialogWidget
{
Q_OBJECT
protected:
QFormLayout *formLayout;
QLineEdit *GroupName;
virtual void createGui();
protected slots:
virtual void dialogAccepted();
virtual void dialogRejected();
void groupNameTextChanged(const QString &text);
public:
explicit AddGroupDialogWidget(const QString &title, QWidget* parent);
virtual ~AddGroupDialogWidget();
};
#endif // ADD_GROUP_DIALOG_WIDGET_H
/*
* %kadu copyright begin%
* Copyright 2012 Wojciech Treter (juzefwt@gmail.com)
* Copyright 2013, 2014 Bartosz Brachaczek (b.brachaczek@gmail.com)
* Copyright 2013 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
* %kadu copyright end%
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#include <QtWidgets/QLineEdit>
#include "buddies/group-manager.h"
#include "edit-group-dialog-widget.h"
EditGroupDialogWidget::EditGroupDialogWidget(Group group, const QString &message, QWidget *parent) :
AddGroupDialogWidget(message, parent), CurrentGroup(group)
{
// QIcon icon = KaduIcon("kadu_icons/kadu").icon();
// Pixmap = icon.pixmap(icon.actualSize(QSize(64, 64)));
//
// createGui();
}
EditGroupDialogWidget::~EditGroupDialogWidget()
{
}
void EditGroupDialogWidget::dialogAccepted()
{
QString newGroupName = GroupName->text();
if (!newGroupName.isEmpty() && GroupManager::instance()->acceptableGroupName(newGroupName))
CurrentGroup.setName(newGroupName);
}
#include "moc_edit-group-dialog-widget.cpp"
/*
* %kadu copyright begin%
* Copyright 2012 Wojciech Treter (juzefwt@gmail.com)
* Copyright 2013, 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
* %kadu copyright end%
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef EDIT_GROUP_DIALOG_WIDGET_H
#define EDIT_GROUP_DIALOG_WIDGET_H
#include "buddies/group.h"
#include "gui/widgets/dialog/add-group-dialog-widget.h"
class EditGroupDialogWidget : public AddGroupDialogWidget
{
Q_OBJECT
Group CurrentGroup;
private slots:
virtual void dialogAccepted();
public:
explicit EditGroupDialogWidget(Group group, const QString &title, QWidget* parent);
virtual ~EditGroupDialogWidget();
};
#endif // EDIT_GROUP_DIALOG_WIDGET_H
......@@ -28,11 +28,10 @@
#include "buddies/group-manager.h"
#include "buddies/group.h"
#include "chat/chat-list-mime-data-helper.h"
#include "core/application.h"
#include "core/core.h"
#include "gui/widgets/dialog/add-group-dialog-widget.h"
#include "gui/widgets/dialog/edit-group-dialog-widget.h"
#include "gui/windows/add-buddy-window.h"
#include "gui/windows/group-properties-window.h"
#include "gui/windows/group-edit-window.h"
#include "gui/windows/kadu-dialog.h"
#include "gui/windows/kadu-window.h"
#include "gui/windows/message-dialog.h"
......@@ -182,18 +181,12 @@ void GroupTabBar::contextMenuEvent(QContextMenuEvent *event)
addBuddyAction->setEnabled(group);
addBuddyAction->setData(group);
QAction *renameGroupAction = menu.addAction(tr("Rename Group"), this, SLOT(renameGroup()));
renameGroupAction->setEnabled(group);
renameGroupAction->setData(group);
menu.addSeparator();
menu.addAction(tr("Add Group"), this, SLOT(createNewGroup()));
QAction *deleteGroupAction = menu.addAction(tr("Delete Group"), this, SLOT(deleteGroup()));
deleteGroupAction->setEnabled(group);
deleteGroupAction->setData(group);
menu.addAction(tr("Add Group"), this, SLOT(createNewGroup()));
menu.addSeparator();
QAction *propertiesAction = menu.addAction(tr("Properties"), this, SLOT(groupProperties()));
......@@ -318,24 +311,6 @@ void GroupTabBar::addBuddy()
addBuddyWindow->show();
}
void GroupTabBar::renameGroup()
{
QAction *action = qobject_cast<QAction *>(sender());
if (!action)
return;
const Group &group = action->data().value<Group>();
if (!group)
return;
EditGroupDialogWidget *groupWidget = new EditGroupDialogWidget(group,
tr("Please enter a new name for the <i>%0</i> group").arg(group.name()),
Core::instance()->kaduWindow());
KaduDialog *window = new KaduDialog(groupWidget, Core::instance()->kaduWindow());
window->setAcceptButtonText(tr("Edit Group"));
window->exec();
}
void GroupTabBar::deleteGroup()
{
QAction *action = qobject_cast<QAction *>(sender());
......@@ -359,10 +334,8 @@ void GroupTabBar::deleteGroup()
void GroupTabBar::createNewGroup()
{
AddGroupDialogWidget *groupWidget = new AddGroupDialogWidget(tr("Please enter the name for the new group"), Core::instance()->kaduWindow());
KaduDialog *window = new KaduDialog(groupWidget, Core::instance()->kaduWindow());
window->setAcceptButtonText(tr("Add Group"));
window->exec();
auto editWindow = new GroupEditWindow{GroupManager::instance(), Application::instance()->configuration()->deprecatedApi(), Group::null, Core::instance()->kaduWindow()};
editWindow->show();
}
void GroupTabBar::groupProperties()
......@@ -371,9 +344,12 @@ void GroupTabBar::groupProperties()
if (!action)
return;
const Group &group = action->data().value<Group>();
if (group)
(new GroupPropertiesWindow(group, Core::instance()->kaduWindow()))->show();
auto group = action->data().value<Group>();
if (!group)
return;
auto editWindow = new GroupEditWindow{GroupManager::instance(), Application::instance()->configuration()->deprecatedApi(), group, Core::instance()->kaduWindow()};
editWindow->show();
}
void GroupTabBar::addToGroup()
......
......@@ -57,7 +57,6 @@ private slots:
void currentChangedSlot(int index);
void addBuddy();
void renameGroup();
void deleteGroup();
void createNewGroup();
void groupProperties();
......
/*
* %kadu copyright begin%
* Copyright 2015 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
* %kadu copyright end%
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#include "group-edit-window.h"
#include "buddies/group-manager.h"
#include "configuration/deprecated-configuration-api.h"
#include "icons/kadu-icon.h"
#include <QtCore/QFileInfo>
#include <QtWidgets/QApplication>
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QFileDialog>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QStyle>
#include <QtWidgets/QToolButton>
#include <QtWidgets/QVBoxLayout>
GroupEditWindow::GroupEditWindow(GroupManager *groupManager, DeprecatedConfigurationApi *configuration, Group group, QWidget *parent) :
QDialog{parent},
m_groupManager{groupManager},
m_configuration{configuration},
m_group{group},
m_add{group.isNull()}
{
setAttribute(Qt::WA_DeleteOnClose, true);
setMinimumWidth(400);
setWindowRole("kadu-group-edit");
setWindowTitle(m_add
? tr("Add group")
: tr("Edit group %1").arg(group.name()));
createGui();
if (m_add)
m_group = Group::create();
loadValues();
dataChanged();
}
GroupEditWindow::~GroupEditWindow()
{
}
void GroupEditWindow::createGui()
{
auto mainWidget = new QWidget{this};
m_nameLineEdit = new QLineEdit{mainWidget};
m_nameErrorLabel = new QLabel(mainWidget);
m_nameCheckBox = new QCheckBox{tr("Show group name"), mainWidget};
m_iconCheckBox = new QCheckBox{tr("Use custom icon"), mainWidget};
m_selectIconButton = new QToolButton{mainWidget};
m_selectIconButton->setAutoRaise(true);
m_selectIconButton->setIconSize(QSize{16, 16});
m_notifyCheckBox = new QCheckBox{tr("Notify about status changes"), mainWidget};
m_offlineCheckBox = new QCheckBox{tr("Offline for this group"), mainWidget};
m_offlineCheckBox->setToolTip(tr("Supported for Gadu-Gadu network"));
m_allGroupCheckBox = new QCheckBox{tr("Show in group \"All\""), mainWidget};
connect(m_nameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(dataChanged()));
connect(m_nameCheckBox, SIGNAL(stateChanged(int)), this, SLOT(dataChanged()));
connect(m_iconCheckBox, SIGNAL(stateChanged(int)), this, SLOT(dataChanged()));
connect(m_selectIconButton, SIGNAL(clicked(bool)), this, SLOT(selectIcon()));
connect(m_notifyCheckBox, SIGNAL(stateChanged(int)), this, SLOT(dataChanged()));
connect(m_offlineCheckBox, SIGNAL(stateChanged(int)), this, SLOT(dataChanged()));
connect(m_offlineCheckBox, SIGNAL(stateChanged(int)), this, SLOT(dataChanged()));
connect(m_allGroupCheckBox, SIGNAL(stateChanged(int)), this, SLOT(dataChanged()));
auto iconWidget = new QWidget{mainWidget};
auto iconLayout = new QHBoxLayout{iconWidget};
iconLayout->setMargin(0);
iconLayout->addWidget(m_iconCheckBox);
iconLayout->addWidget(m_selectIconButton);
iconLayout->addStretch(100);
auto layout = new QFormLayout{mainWidget};
layout->addRow(tr("Name:"), m_nameLineEdit);
layout->addWidget(m_nameErrorLabel);
layout->addWidget(m_nameCheckBox);
layout->addWidget(iconWidget);
layout->addWidget(m_notifyCheckBox);
layout->addWidget(m_offlineCheckBox);
layout->addWidget(m_allGroupCheckBox);
auto saveTitle = m_add
? tr("Add group")
: tr("Save group");
m_saveButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogOkButton), saveTitle, this);
m_saveButton->setDefault(true);
connect(m_saveButton, SIGNAL(clicked(bool)), this, SLOT(accept()));
if (!m_add)
{
m_applyButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogApplyButton), tr("Apply"), this);
connect(m_applyButton, SIGNAL(clicked(bool)), this, SLOT(apply()));
}
else
m_applyButton = nullptr;
auto cancel = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this);
connect(cancel, SIGNAL(clicked(bool)), this, SLOT(reject()));
auto dialogButtonBox = new QDialogButtonBox{this};
dialogButtonBox->addButton(m_saveButton, QDialogButtonBox::AcceptRole);
if (m_applyButton)
dialogButtonBox->addButton(m_applyButton, QDialogButtonBox::ApplyRole);
dialogButtonBox->addButton(cancel, QDialogButtonBox::DestructiveRole);
auto mainLayout = new QVBoxLayout{this};
mainLayout->addWidget(mainWidget);
mainLayout->addSpacing(16);
mainLayout->addStretch(100);
mainLayout->addWidget(dialogButtonBox);
m_nameLineEdit->setFocus();
}
void GroupEditWindow::loadValues()
{
m_nameLineEdit->setText(m_group.name());
m_nameCheckBox->setChecked(m_group.showName());
m_iconCheckBox->setChecked(m_group.showIcon());
m_notifyCheckBox->setChecked(m_group.notifyAboutStatusChanges());
m_offlineCheckBox->setChecked(m_group.offlineToGroup());
m_allGroupCheckBox->setChecked(m_group.showInAllGroup());
m_selectedIcon = m_group.icon();
auto iconFile = QFileInfo{m_selectedIcon};
if (iconFile.exists())
m_selectIconButton->setIcon(QIcon{iconFile.absoluteFilePath()});
else
m_selectIconButton->setIcon(KaduIcon{"document-open", "16"}.icon());
}
void GroupEditWindow::storeValues()
{
m_group.setName(m_nameLineEdit->text());
m_group.setShowName(m_nameCheckBox->isChecked());
m_group.setShowIcon(m_iconCheckBox->isChecked());
m_group.setIcon(m_selectedIcon);
m_group.setNotifyAboutStatusChanges(m_notifyCheckBox->isChecked());
m_group.setOfflineToGroup(m_offlineCheckBox->isChecked());
m_group.setShowInAllGroup(m_allGroupCheckBox->isChecked());
}
void GroupEditWindow::selectIcon()
{
auto recentPath = m_configuration->readEntry("GroupIcon", "recentPath", "~/");
auto file = QFileDialog::getOpenFileName(this, tr("Choose an icon"), recentPath, tr("Images (*.png *.xpm *.jpg);;All Files (*)"));
auto iconFile = QFileInfo{file};
if (iconFile.exists() && iconFile.isReadable())
{
m_configuration->writeEntry("GroupIcon", "recentPath", iconFile.absolutePath());
m_selectIconButton->setIcon(QIcon{iconFile.absoluteFilePath()});
m_selectedIcon = file;
}
}
void GroupEditWindow::dataChanged()
{
m_saveButton->setEnabled(false);
if (m_applyButton)
m_applyButton->setEnabled(false);
m_selectIconButton->setEnabled(m_iconCheckBox->isChecked());
auto invalidNameMessage = m_groupManager->validateGroupName(m_group, m_nameLineEdit->text());
if (!invalidNameMessage.isEmpty())
{
m_nameErrorLabel->setText(QString{"<small><i>%1</i></small>"}.arg(invalidNameMessage));
return;
}
else
m_nameErrorLabel->setText(QString{"<small><i>&nbsp;</i></small>"}.arg(invalidNameMessage));
if (m_nameLineEdit->text() != m_group.name() ||
m_nameCheckBox->isChecked() != m_group.showName() ||
m_iconCheckBox->isChecked() != m_group.showIcon() ||
m_selectedIcon != m_group.icon() ||
m_notifyCheckBox->isChecked() != m_group.notifyAboutStatusChanges() ||
m_offlineCheckBox->isChecked() != m_group.offlineToGroup() ||
m_allGroupCheckBox->isChecked() != m_group.showInAllGroup())
{
m_saveButton->setEnabled(true);
if (m_applyButton)
m_applyButton->setEnabled(true);
}
}
void GroupEditWindow::accept()
{
storeValues();
if (m_add)
m_groupManager->addItem(m_group);
QDialog::accept();
}
void GroupEditWindow::apply()
{
storeValues();
}
#include "moc_group-edit-window.cpp"
/*
* %kadu copyright begin%
* Copyright 2009, 2010, 2011 Piotr Galiszewski (piotr.galiszewski@kadu.im)
* Copyright 2011 Piotr Dąbrowski (ultr@ultr.pl)
* Copyright 2014 Bartosz Brachaczek (b.brachaczek@gmail.com)
* Copyright 2009, 2010, 2011, 2013, 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
* Copyright 2015 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
* %kadu copyright end%
*
* This program is free software; you can redistribute it and/or
......@@ -20,46 +17,58 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GROUP_PROPERTIES_WINDOW
#define GROUP_PROPERTIES_WINDOW
#include <QtWidgets/QWidget>
#pragma once
#include "buddies/group.h"
#include "os/generic/desktop-aware-object.h"
#include <QtWidgets/QDialog>
class DeprecatedConfigurationApi;
class GroupManager;
class QCheckBox;
class QLabel;
class QPushButton;
class QLineEdit;
class QToolButton;
class GroupPropertiesWindow : public QWidget, DesktopAwareObject
class GroupEditWindow : public QDialog
{
Q_OBJECT
Group group;
public:
explicit GroupEditWindow(GroupManager *groupManager, DeprecatedConfigurationApi *configuration, Group group, QWidget *parent = nullptr);
virtual ~GroupEditWindow();
protected:
virtual void accept() override;
QCheckBox *notifyCheckBox;
QCheckBox *offlineCheckBox;
QCheckBox *allGroupCheckBox;
QCheckBox *iconCheckBox;
QCheckBox *nameCheckBox;
private:
GroupManager *m_groupManager;
DeprecatedConfigurationApi *m_configuration;
QLabel *info;
Group m_group;
bool m_add;
QString m_selectedIcon;
QPushButton *icon;
QString iconPath;
QLineEdit *m_nameLineEdit;
QLabel *m_nameErrorLabel;
QCheckBox *m_nameCheckBox;
QCheckBox *m_iconCheckBox;
QToolButton *m_selectIconButton;
QCheckBox *m_notifyCheckBox;