HistoryChatView::HistoryChatView(QObject *parent) : ChatViewHooks(parent) , m_remove(0) { synced(); connect(ChatClient::io(), SIGNAL(ready()), SLOT(ready())); connect(ChatNotify::i(), SIGNAL(notify(Notify)), SLOT(notify(Notify))); connect(ChatCore::settings(), SIGNAL(changed(QString,QVariant)), SLOT(settingsChanged(QString,QVariant))); connect(ChatCore::settings(), SIGNAL(synced()), SLOT(synced())); }
StateCache::StateCache(QObject *parent) : QObject(parent) , m_settings(ChatCore::settings()) , m_key(SETTINGS_PINNED_TABS) { m_settings->setDefault(m_key, QStringList()); connect(m_settings, SIGNAL(changed(QString,QVariant)), SLOT(settingsChanged(QString,QVariant))); connect(m_settings, SIGNAL(synced()), SLOT(synced())); connect(ChatClient::i(), SIGNAL(ready()), SLOT(ready())); QTimer::singleShot(0, this, SIGNAL(start())); }
void AccountInterfacePrivate::setAccount(Accounts::Account *acc) { if (!acc) { qWarning() << "AccountInterface: setAccount() called with null account! Aborting operation."; return; } if (account) { qWarning() << "AccountInterface: setAccount() called but account already set! Aborting operation."; return; } account = acc; // connect up our signals. connect(account, SIGNAL(enabledChanged(QString,bool)), this, SLOT(enabledHandler(QString,bool))); connect(account, SIGNAL(displayNameChanged(QString)), this, SLOT(displayNameChangedHandler())); connect(account, SIGNAL(synced()), this, SLOT(handleSynced())); connect(account, SIGNAL(removed()), this, SLOT(invalidate())); connect(account, SIGNAL(destroyed()), this, SLOT(invalidate())); // first time read from db. we should be in Initializing state to begin with. // QueuedConnection to ensure that clients have a chance to connect to state changed signals. QMetaObject::invokeMethod(this, "asyncQueryInfo", Qt::QueuedConnection); }
char *get_status ( int hosts_size ) { json_lib::Status json_val; std::map<std::string, int> total_status; std::map<std::string, std::map<std::string, int> > status; std::string processed ("processed_items"); std::string synced ("synced_items"); total_status[processed] = * ( uint64_t * ) total_status_addr; total_status[synced] = * ( uint64_t * ) ( total_status_addr + sizeof (uint64_t ) ); for ( int i = 0; i < hosts_size; i ++ ) { std::map<std::string, int> single_status; single_status[processed] = * ( uint64_t * ) total_status_addrs[i]; single_status[synced] = * ( uint64_t * ) ( total_status_addrs[i] + sizeof (uint64_t ) ); status[hosts[i]] = single_status; } json_val.total_status = total_status; json_val.status = status; std::string res; if ( ! json_lib::Serialize (json_val, res) ) { return NULL; } size_t status_size = res.size (); char *status_addr = ( char * ) malloc (status_size + 1); if ( ! status_addr ) { return NULL; } memcpy (status_addr, res.c_str (), status_size); status_addr[status_size] = '\0'; return status_addr; }
bool get_status (int hosts_size, std::string& resp) { jos_lib::Status json_val; std::map<std::string, int> total_status; std::map<std::string, std::map<std::string, int> > status; std::string processed ("processed_items"); std::string synced ("synced_items"); total_status[processed] = * ( uint64_t * ) total_status_addr; total_status[synced] = * ( uint64_t * ) ( total_status_addr + sizeof (uint64_t ) ); for ( int i = 0; i < hosts_size; i ++ ) { std::map<std::string, int> single_status; single_status[processed] = * ( uint64_t * ) total_status_addrs[i]; single_status[synced] = * ( uint64_t * ) ( total_status_addrs[i] + sizeof (uint64_t ) ); status[hosts[i]] = single_status; } json_val.total_status = total_status; json_val.status = status; return jos_lib::Serialize <jos_lib::Status, true> (json_val, resp); }