Example #1
0
void Groups::refreshMessage(not_null<HistoryItem*> item) {
	if (!isGrouped(item)) {
		unregisterMessage(item);
		return;
	}
	if (!IsServerMsgId(item->id)) {
		return;
	}
	const auto groupId = item->groupId();
	const auto i = _groups.find(groupId);
	if (i == end(_groups)) {
		registerMessage(item);
		return;
	}
	auto &items = i->second.items;
	const auto position = findPositionForItem(items, item);
	auto current = ranges::find(items, item);
	if (current == end(items)) {
		items.insert(position, item);
	} else if (position == current + 1) {
		return;
	} else if (position > current + 1) {
		for (++current; current != position; ++current) {
			std::swap(*(current - 1), *current);
		}
	} else if (position < current) {
		for (; current != position; --current) {
			std::swap(*(current - 1), *current);
		}
	} else {
		Unexpected("Position of item in Groups::refreshMessage().");
	}
	refreshViews(items);
}
Example #2
0
int Settings::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: refreshViews(); break;
        case 1: preInitialize(); break;
        case 2: initialize(); break;
        case 3: load(); break;
        case 4: createGUI(); break;
        case 5: lexiconChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 6: alphabetChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 7: boardChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 8: addBoard(); break;
        case 9: editBoard(); break;
        case 10: deleteBoard(); break;
        case 11: setQuackleToUseLexiconName((*reinterpret_cast< const string(*)>(_a[1]))); break;
        case 12: setQuackleToUseAlphabetName((*reinterpret_cast< const string(*)>(_a[1]))); break;
        case 13: setQuackleToUseBoardName((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        }
        _id -= 14;
    }
    return _id;
}
Example #3
0
void ConfigDialog::apply()
{
	for (QList<ConfigPage *>::iterator it = m_configPages.begin(); it != m_configPages.end(); ++it)
	{
		(*it)->writeConfig();
	}

	emit refreshViews();
}
Example #4
0
void ConfigDialog::apply()
{
	for (auto& it : m_configPages)
	{
		it->writeConfig();
	}

	emit refreshViews();
}
Example #5
0
void Groups::registerMessage(not_null<HistoryItem*> item) {
	if (!isGrouped(item)) {
		return;
	}
	const auto i = _groups.emplace(item->groupId(), Group()).first;
	auto &items = i->second.items;
	if (items.size() < kMaxItemsInGroup) {
		items.insert(findPositionForItem(items, item), item);
		if (items.size() > 1) {
			refreshViews(items);
		}
	}
}
Example #6
0
ProcessInfoForm::ProcessInfoForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ProcessInfoForm),
    mItemModel(),
    mMenu(NULL),
    mProcessInfo(NULL),
    mCurProcess()
{
    ui->setupUi(this);

    mProcessInfo = SystemInfoProvider::getInstance()->getProcessInfo();

    ui->rdoAllProcess->setChecked(true);
    initTableView();
    initConnection();
    refreshViews();
}
Example #7
0
void LayoutManager::addWindow(IWindow& window)
{
	auto windowId = safe_str(window.id());

	auto windowIt = windows_.find(windowId);
	if (windowIt != windows_.end())
	{
		// error?
		return;
	}

	windows_[windowId] = &window;

	// after adding a window we need to reevaluate all the actions and views that we registered
	// against this window as they now all need to be added to the UI
	refreshActions(window);
	refreshViews(window);
}
Example #8
0
ResourcesForm::ResourcesForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ResourcesForm),
    mCPUInfo(NULL),
    mMemoryInfo(NULL),
    mNetworkInfo(NULL)
{
    ui->setupUi(this);

    mCPUInfo = SystemInfoProvider::getInstance()->getCPUInfo();
    mMemoryInfo = SystemInfoProvider::getInstance()->getMemoryInfo();
    mNetworkInfo = SystemInfoProvider::getInstance()->getNetworkInfo();

    initCPUTableView();
    initMemoryProgressBars();
    initNetTableView();
    refreshViews();
}
Example #9
0
void Groups::unregisterMessage(not_null<const HistoryItem*> item) {
	const auto groupId = item->groupId();
	if (!groupId) {
		return;
	}
	const auto i = _groups.find(groupId);
	if (i != end(_groups)) {
		auto &items = i->second.items;
		const auto removed = ranges::remove(items, item);
		const auto last = end(items);
		if (removed != last) {
			items.erase(removed, last);
			if (!items.empty()) {
				refreshViews(items);
			} else {
				_groups.erase(i);
			}
		}
	}
}
Example #10
0
{
    connect(ui->rdoAllProcess, SIGNAL(clicked(bool)),
            this, SLOT(showAllProcess(bool)));
    connect(ui->rdoMyProcess, SIGNAL(clicked(bool)),
            this, SLOT(showMyProcess(bool)));
    connect(ui->tbvProcesses->horizontalHeader(), SIGNAL(sectionClicked(int)),
            this, SLOT(sortProcess(int)));
    connect(ui->tbvProcesses, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(showMenu(QPoint)));
    connect(ui->tbvProcesses, SIGNAL(clicked(QModelIndex)),
            this, SLOT(setCurProcess(QModelIndex)));
    connect(ui->tbvProcesses, SIGNAL(pressed(QModelIndex)),
            this, SLOT(setCurProcess(QModelIndex)));

    connect(SystemInfoProvider::getInstance(), SIGNAL(resort()),
            this, SLOT(refreshViews()));
    connect(SystemInfoProvider::getInstance(), SIGNAL(resetUserFilter()),
            this, SLOT(refreshViews()));
}

void ProcessInfoForm::refreshTableItems()
{
    int processCount = (int)mProcessInfo->getProcessCount();
    int index = 0;
    mProcessInfo->begin();
    while (mProcessInfo->hasNext())
    {
        setTableItem(index++, mProcessInfo->next());
    }

    if (mItemModel.rowCount() > processCount)