本文整理汇总了C++中IServerSPtr类的典型用法代码示例。如果您正苦于以下问题:C++ IServerSPtr类的具体用法?C++ IServerSPtr怎么用?C++ IServerSPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IServerSPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clear
void ServersManager::clear()
{
for(size_t i = 0; i < servers_.size(); ++i){
IServerSPtr ser = servers_[i];
ser->driver()->stop();
}
servers_.clear();
}
示例2: connectionType
connectionTypes QueryWidget::connectionType() const
{
IServerSPtr ser = shellWidget_->server();
if(!ser){
return DBUNKNOWN;
}
return ser->type();
}
示例3: IServerSPtr
IServerSPtr ServersManager::findServerBySetting(const IConnectionSettingsBaseSPtr &settings) const
{
for(size_t i = 0; i < servers_.size(); ++i){
IServerSPtr drp = servers_[i];
IDriverSPtr curDr = drp->driver();
if(curDr->settings() == settings){
return drp;
}
}
return IServerSPtr();
}
示例4: DCHECK
IServerSPtr ServersManager::createServer(IConnectionSettingsBaseSPtr settings)
{
DCHECK(settings);
IServerSPtr result;
connectionTypes conT = settings->connectionType();
IServerSPtr ser = findServerBySetting(settings);
if(conT == REDIS){
RedisServer *newRed = NULL;
if(!ser){
IDriverSPtr dr(new RedisDriver(settings));
dr->start();
newRed = new RedisServer(dr, true);
}
else{
newRed = new RedisServer(ser->driver(), false);
}
result.reset(newRed);
servers_.push_back(result);
}
else if(conT == MEMCACHED){
MemcachedServer *newMem = NULL;
if(!ser){
IDriverSPtr dr(new MemcachedDriver(settings));
dr->start();
newMem = new MemcachedServer(dr, true);
}
else{
newMem = new MemcachedServer(ser->driver(), false);
}
result.reset(newMem);
servers_.push_back(result);
}
else if(conT == SSDB){
SsdbServer *newSsdb = NULL;
if(!ser){
IDriverSPtr dr(new SsdbDriver(settings));
dr->start();
newSsdb = new SsdbServer(dr, true);
}
else{
newSsdb = new SsdbServer(ser->driver(), false);
}
result.reset(newSsdb);
servers_.push_back(result);
}
DCHECK(result);
if(ser && syncServers_){
result->syncWithServer(ser.get());
}
return result;
}
示例5:
std::vector<QObject *> ServersManager::findAllListeners(const IDriverSPtr &drv) const
{
std::vector<QObject *> result;
for(size_t j = 0; j < servers_.size(); ++j){
IServerSPtr ser = servers_[j];
if(ser->driver() == drv){
result.push_back(ser.get());
}
}
return result;
}
示例6: QWidget
OutputWidget::OutputWidget(IServerSPtr server, QWidget* parent)
: QWidget(parent)
{
commonModel_ = new FastoCommonModel(this);
VERIFY(connect(commonModel_, &FastoCommonModel::changedValue, server.get(), &IServer::changeValue, Qt::DirectConnection));
VERIFY(connect(server.get(), &IServer::startedChangeDbValue, this, &OutputWidget::startChangeDbValue, Qt::DirectConnection));
VERIFY(connect(server.get(), &IServer::finishedChangeDbValue, this, &OutputWidget::finishChangeDbValue, Qt::DirectConnection));
treeView_ = new FastoTreeView;
treeView_->setModel(commonModel_);
tableView_ = new FastoTableView;
tableView_->setModel(commonModel_);
textView_ = new FastoTextView(server->outputDelemitr());
textView_->setModel(commonModel_);
textView_->setReadOnly(true);
timeLabel_ = new fasto::qt::gui::IconLabel(GuiFactory::instance().timeIcon(), "0", QSize(32, 32));
QVBoxLayout* mainL = new QVBoxLayout;
QHBoxLayout* topL = new QHBoxLayout;
QSplitter* splitter = new QSplitter;
splitter->setOrientation(Qt::Horizontal);
splitter->setHandleWidth(1);
splitter->setContentsMargins(0, 0, 0, 0);
treeButton_ = new QPushButton;
tableButton_ = new QPushButton;
textButton_ = new QPushButton;
treeButton_->setIcon(GuiFactory::instance().treeIcon());
VERIFY(connect(treeButton_, SIGNAL(clicked()), this, SLOT(setTreeView())));
tableButton_->setIcon(GuiFactory::instance().tableIcon());
VERIFY(connect(tableButton_, SIGNAL(clicked()), this, SLOT(setTableView())));
textButton_->setIcon(GuiFactory::instance().textIcon());
VERIFY(connect(textButton_, SIGNAL(clicked()), this, SLOT(setTextView())));
topL->addWidget(treeButton_);
topL->addWidget(tableButton_);
topL->addWidget(textButton_);
topL->addWidget(splitter);
topL->addWidget(timeLabel_);
mainL->addLayout(topL);
mainL->addWidget(treeView_);
mainL->addWidget(tableView_);
mainL->addWidget(textView_);
setLayout(mainL);
syncWithSettings();
}
示例7: void
ServerHistoryDialog::ServerHistoryDialog(IServerSPtr server, QWidget* parent)
: QDialog(parent, Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint ), server_(server)
{
using namespace translations;
CHECK(server_);
setWindowIcon(GuiFactory::instance().icon(server_->type()));
graphWidget_ = new fasto::qt::gui::GraphWidget;
settingsGraph_ = new QWidget;
QHBoxLayout *mainL = new QHBoxLayout;
QSplitter *splitter = new QSplitter;
splitter->setOrientation(Qt::Horizontal);
splitter->setHandleWidth(1);
mainL->addWidget(splitter);
splitter->addWidget(settingsGraph_);
clearHistory_ = new QPushButton;
VERIFY(connect(clearHistory_, &QPushButton::clicked, this, &ServerHistoryDialog::clearHistory));
serverInfoGroupsNames_ = new QComboBox;
serverInfoFields_ = new QComboBox;
typedef void (QComboBox::*curc)(int);
VERIFY(connect(serverInfoGroupsNames_, static_cast<curc>(&QComboBox::currentIndexChanged), this, &ServerHistoryDialog::refreshInfoFields ));
VERIFY(connect(serverInfoFields_, static_cast<curc>(&QComboBox::currentIndexChanged), this, &ServerHistoryDialog::refreshGraph ));
const std::vector<std::string> headers = infoHeadersFromType(server_->type());
for(int i = 0; i < headers.size(); ++i){
serverInfoGroupsNames_->addItem(common::convertFromString<QString>(headers[i]));
}
QVBoxLayout *setingsLayout = new QVBoxLayout;
setingsLayout->addWidget(clearHistory_);
setingsLayout->addWidget(serverInfoGroupsNames_);
setingsLayout->addWidget(serverInfoFields_);
settingsGraph_->setLayout(setingsLayout);
splitter->addWidget(graphWidget_);
setLayout(mainL);
glassWidget_ = new fasto::qt::gui::GlassWidget(GuiFactory::instance().pathToLoadingGif(), trLoading, 0.5, QColor(111, 111, 100), this);
VERIFY(connect(server.get(), &IServer::startedLoadServerHistoryInfo, this, &ServerHistoryDialog::startLoadServerHistoryInfo));
VERIFY(connect(server.get(), &IServer::finishedLoadServerHistoryInfo, this, &ServerHistoryDialog::finishLoadServerHistoryInfo));
VERIFY(connect(server.get(), &IServer::startedClearServerHistory, this, &ServerHistoryDialog::startClearServerHistory));
VERIFY(connect(server.get(), &IServer::finishedClearServerHistory, this, &ServerHistoryDialog::finishClearServerHistory));
VERIFY(connect(server.get(), &IServer::serverInfoSnapShoot, this, &ServerHistoryDialog::snapShotAdd));
retranslateUi();
}
示例8: DCHECK
IDatabase::IDatabase(IServerSPtr server, DataBaseInfoSPtr info)
: info_(info), server_(server)
{
DCHECK(server);
DCHECK(info);
DCHECK(server->type() == info->type());
}
示例9: QWidget
QueryWidget::QueryWidget(IServerSPtr server, QWidget* parent)
: QWidget(parent)
{
shellWidget_ = new BaseShellWidget(server);
outputWidget_ = new OutputWidget(server.get());
VERIFY(connect(shellWidget_, &BaseShellWidget::rootCreated, outputWidget_, &OutputWidget::rootCreate));
VERIFY(connect(shellWidget_, &BaseShellWidget::rootCompleated, outputWidget_, &OutputWidget::rootCompleate));
VERIFY(connect(shellWidget_, &BaseShellWidget::addedChild, outputWidget_, &OutputWidget::addChild));
VERIFY(connect(shellWidget_, &BaseShellWidget::itemUpdated, outputWidget_, &OutputWidget::itemUpdate));
QSplitter* splitter = new QSplitter;
#ifdef OS_WIN
splitter->setStyleSheet("QSplitter::handle { background-color: gray }");
#endif
splitter->setOrientation(Qt::Vertical);
splitter->setHandleWidth(1);
splitter->setContentsMargins(0, 0, 0, 0);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->setSpacing(0);
splitter->addWidget(shellWidget_);
splitter->addWidget(outputWidget_);
splitter->setStretchFactor(0, 0);
splitter->setStretchFactor(1, 1);
mainLayout->addWidget(splitter);
setLayout(mainLayout);
}
示例10: IDatabase
SsdbDatabase::SsdbDatabase(IServerSPtr server, IDataBaseInfoSPtr info)
: IDatabase(server, info) {
DCHECK(server);
DCHECK(info);
DCHECK(server->type() == SSDB);
DCHECK(info->type() == SSDB);
}
示例11: IDatabase
MemcachedDatabase::MemcachedDatabase(IServerSPtr server, DataBaseInfoSPtr info)
: IDatabase(server, info)
{
DCHECK(server);
DCHECK(info);
DCHECK(server->type() == MEMCACHED);
DCHECK(info->type() == MEMCACHED);
}
示例12: selectedIndex
void ExplorerTreeView::openPropertyServerDialog()
{
QModelIndex sel = selectedIndex();
if(!sel.isValid()){
return;
}
ExplorerServerItem *node = common::utils_qt::item<ExplorerServerItem*>(sel);
if(!node){
return;
}
IServerSPtr server = node->server();
if(!server){
return;
}
PropertyServerDialog infDialog(QString("%1 properties").arg(server->name()), server->type(), this);
VERIFY(connect(server.get(), &IServer::startedLoadServerProperty, &infDialog, &PropertyServerDialog::startServerProperty));
VERIFY(connect(server.get(), &IServer::finishedLoadServerProperty, &infDialog, &PropertyServerDialog::finishServerProperty));
VERIFY(connect(server.get(), &IServer::startedChangeServerProperty, &infDialog, &PropertyServerDialog::startServerChangeProperty));
VERIFY(connect(server.get(), &IServer::finishedChangeServerProperty, &infDialog, &PropertyServerDialog::finishServerChangeProperty));
VERIFY(connect(&infDialog, &PropertyServerDialog::changedProperty, server.get(), &IServer::changeProperty));
VERIFY(connect(&infDialog, &PropertyServerDialog::showed, server.get(), &IServer::serverProperty));
infDialog.exec();
}
示例13: removeServer
void ExplorerTreeModel::removeServer(IServerSPtr server)
{
fasto::qt::gui::TreeItem *par = dynamic_cast<fasto::qt::gui::TreeItem*>(root_);
DCHECK(par);
if(!par){
return;
}
ExplorerServerItem *serverItem = findServerItem(server.get());
if(serverItem){
removeItem(QModelIndex(), serverItem);
}
}
示例14: closeServer
void ServersManager::closeServer(IServerSPtr server)
{
for(size_t i = 0; i < servers_.size(); ++i){
IServerSPtr ser = servers_[i];
if(ser == server){
if(ser->isSuperServer()){
IDriverSPtr drv = ser->driver();
for(size_t j = 0; j < servers_.size(); ++j){
IServerSPtr servj = servers_[j];
if(servj->driver() == drv){
servj->isSuperServer_ = true;
break;
}
}
}
servers_.erase(servers_.begin()+i);
refreshSyncServers();
break;
}
}
}
示例15: refreshSyncServers
void ServersManager::refreshSyncServers()
{
for(size_t i = 0; i < servers_.size(); ++i){
IServerSPtr servi = servers_[i];
if(servi->isSuperServer()){
for(size_t j = 0; j < servers_.size(); ++j){
IServerSPtr servj = servers_[j];
if(servj != servi && servj->driver() == servi->driver()){
if(syncServers_){
servj->syncWithServer(servi.get());
}
else{
servj->unSyncFromServer(servi.get());
}
}
}
}
}
}