2021-07-31 16:15:43 +02:00
|
|
|
#include "NicknamesPage.hpp"
|
|
|
|
|
|
|
|
#include "controllers/nicknames/NicknamesModel.hpp"
|
|
|
|
#include "singletons/Settings.hpp"
|
|
|
|
#include "singletons/WindowManager.hpp"
|
|
|
|
#include "util/LayoutCreator.hpp"
|
|
|
|
#include "widgets/helper/EditableModelView.hpp"
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include "widgets/Window.hpp"
|
2021-07-31 16:15:43 +02:00
|
|
|
|
|
|
|
#include <QHeaderView>
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include <QTableView>
|
2021-07-31 16:15:43 +02:00
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
NicknamesPage::NicknamesPage()
|
|
|
|
{
|
|
|
|
LayoutCreator<NicknamesPage> layoutCreator(this);
|
|
|
|
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
|
|
|
|
|
|
|
|
layout.emplace<QLabel>(
|
|
|
|
"Nicknames do not work with features such as search or user highlights."
|
|
|
|
"\nWith those features you will still need to use the user's original "
|
|
|
|
"name.");
|
|
|
|
EditableModelView *view =
|
|
|
|
layout
|
|
|
|
.emplace<EditableModelView>(
|
|
|
|
(new NicknamesModel(nullptr))
|
|
|
|
->initialized(&getSettings()->nicknames))
|
|
|
|
.getElement();
|
|
|
|
|
2021-08-29 15:06:07 +02:00
|
|
|
view->setTitles({"Username", "Nickname", "Enable regex", "Case-sensitive"});
|
2021-07-31 16:15:43 +02:00
|
|
|
view->getTableView()->horizontalHeader()->setSectionResizeMode(
|
2021-08-22 13:30:17 +02:00
|
|
|
QHeaderView::Fixed);
|
|
|
|
view->getTableView()->horizontalHeader()->setSectionResizeMode(
|
|
|
|
0, QHeaderView::Stretch);
|
2021-07-31 16:15:43 +02:00
|
|
|
view->getTableView()->horizontalHeader()->setSectionResizeMode(
|
|
|
|
1, QHeaderView::Stretch);
|
|
|
|
|
|
|
|
view->addButtonPressed.connect([] {
|
2021-08-22 13:30:17 +02:00
|
|
|
getSettings()->nicknames.append(
|
|
|
|
Nickname{"Username", "Nickname", false, false});
|
2021-07-31 16:15:43 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
QTimer::singleShot(1, [view] {
|
|
|
|
view->getTableView()->resizeColumnsToContents();
|
2021-08-22 13:30:17 +02:00
|
|
|
view->getTableView()->setColumnWidth(0, 200);
|
2021-07-31 16:15:43 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace chatterino
|