MainWidget::MainWidget (QWidget *parent) : QWidget (parent) , UpperBar_ (new QToolBar) , MenuGeneral_ (new QMenu (tr ("General"))) , ProxyModel_ (new SortFilterProxyModel ()) { Ui_.setupUi (this); ProxyModel_->setSourceModel (Core::Instance ().GetCLModel ()); Ui_.CLTree_->setModel (ProxyModel_); QVBoxLayout *lay = qobject_cast<QVBoxLayout*> (layout ()); lay->insertWidget (0, UpperBar_); QAction *accountsList = new QAction (tr ("Accounts..."), this); connect (accountsList, SIGNAL (triggered ()), this, SLOT (showAccountsList ())); MenuGeneral_->addAction (accountsList); UpperBar_->addAction (MenuGeneral_->menuAction ()); ActionChangeStatus_ = new QAction (tr ("Change status..."), this); connect (ActionChangeStatus_, SIGNAL (triggered ()), this, SLOT (handleChangeStatusRequested ())); }
void MainWidget::fastStateChangeRequested () { const auto& stateVar = sender ()->property ("Azoth/TargetState"); if (stateVar.isNull ()) { handleChangeStatusRequested (); return; } const auto state = stateVar.value<State> (); updateFastStatusButton (state); const EntryStatus status (state, AccountActsMgr_->GetStatusText (static_cast<QAction*> (sender ()), state)); for (IAccount *acc : Core::Instance ().GetAccounts ()) if (acc->IsShownInRoster ()) acc->ChangeState (status); }