mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
added add account login back in
This commit is contained in:
parent
7e68e662e3
commit
0fed9ca5d2
|
@ -8,6 +8,9 @@ namespace accounts {
|
|||
|
||||
AccountController::AccountController()
|
||||
{
|
||||
this->twitch.accounts.itemInserted.connect([this](const auto &args) {
|
||||
accounts.insertItem(std::dynamic_pointer_cast<Account>(args.item));
|
||||
});
|
||||
}
|
||||
|
||||
void AccountController::load()
|
||||
|
|
|
@ -11,6 +11,13 @@
|
|||
namespace chatterino {
|
||||
namespace util {
|
||||
|
||||
template <typename TVectorItem>
|
||||
struct SignalVectorItemArgs {
|
||||
const TVectorItem &item;
|
||||
int index;
|
||||
void *caller;
|
||||
};
|
||||
|
||||
template <typename TVectorItem>
|
||||
class ReadOnlySignalVector : boost::noncopyable
|
||||
{
|
||||
|
@ -24,14 +31,8 @@ public:
|
|||
}
|
||||
virtual ~ReadOnlySignalVector() = default;
|
||||
|
||||
struct ItemArgs {
|
||||
const TVectorItem &item;
|
||||
int index;
|
||||
void *caller;
|
||||
};
|
||||
|
||||
pajlada::Signals::Signal<ItemArgs> itemInserted;
|
||||
pajlada::Signals::Signal<ItemArgs> itemRemoved;
|
||||
pajlada::Signals::Signal<SignalVectorItemArgs<TVectorItem>> itemInserted;
|
||||
pajlada::Signals::Signal<SignalVectorItemArgs<TVectorItem>> itemRemoved;
|
||||
pajlada::Signals::NoArgSignal delayedItemsChanged;
|
||||
|
||||
const std::vector<TVectorItem> &getVector() const
|
||||
|
@ -69,7 +70,7 @@ public:
|
|||
|
||||
TVectorItem item = this->vector[index];
|
||||
this->vector.erase(this->vector.begin() + index);
|
||||
typename ReadOnlySignalVector<TVectorItem>::ItemArgs args{item, index, caller};
|
||||
SignalVectorItemArgs<TVectorItem> args{item, index, caller};
|
||||
this->itemRemoved.invoke(args);
|
||||
|
||||
this->invokeDelayedItemsChanged();
|
||||
|
@ -96,7 +97,7 @@ public:
|
|||
|
||||
this->vector.insert(this->vector.begin() + index, item);
|
||||
|
||||
typename ReadOnlySignalVector<TVectorItem>::ItemArgs args{item, index, caller};
|
||||
SignalVectorItemArgs<TVectorItem> args{item, index, caller};
|
||||
this->itemInserted.invoke(args);
|
||||
this->invokeDelayedItemsChanged();
|
||||
return index;
|
||||
|
@ -115,7 +116,7 @@ public:
|
|||
int index = it - this->vector.begin();
|
||||
this->vector.insert(it, item);
|
||||
|
||||
typename ReadOnlySignalVector<TVectorItem>::ItemArgs args{item, index, caller};
|
||||
SignalVectorItemArgs<TVectorItem> args{item, index, caller};
|
||||
this->itemInserted.invoke(args);
|
||||
this->invokeDelayedItemsChanged();
|
||||
return index;
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
{
|
||||
this->vector = vec;
|
||||
|
||||
auto insert = [this](const typename BaseSignalVector<TVectorItem>::ItemArgs &args) {
|
||||
auto insert = [this](const SignalVectorItemArgs<TVectorItem> &args) {
|
||||
if (args.caller == this) {
|
||||
return;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
int i = 0;
|
||||
for (const TVectorItem &item : vec->getVector()) {
|
||||
typename BaseSignalVector<TVectorItem>::ItemArgs args{item, i++, 0};
|
||||
SignalVectorItemArgs<TVectorItem> args{item, i++, 0};
|
||||
|
||||
insert(args);
|
||||
}
|
||||
|
|
|
@ -579,7 +579,7 @@ bool ChannelView::isPaused()
|
|||
|
||||
void ChannelView::paintEvent(QPaintEvent * /*event*/)
|
||||
{
|
||||
// BenchmarkGuard benchmark("paint event");
|
||||
BenchmarkGuard benchmark("paint event");
|
||||
|
||||
QPainter painter(this);
|
||||
|
||||
|
|
|
@ -33,7 +33,10 @@ AccountsPage::AccountsPage()
|
|||
view->setTitles({"Name"});
|
||||
view->getTableView()->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
view->addButtonPressed.connect([] {});
|
||||
view->addButtonPressed.connect([] {
|
||||
static auto loginWidget = new LoginWidget();
|
||||
loginWidget->show();
|
||||
});
|
||||
|
||||
// auto buttons = layout.emplace<QDialogButtonBox>();
|
||||
// {
|
||||
|
|
Loading…
Reference in a new issue