本文整理汇总了C++中UserManager类的典型用法代码示例。如果您正苦于以下问题:C++ UserManager类的具体用法?C++ UserManager怎么用?C++ UserManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int ac, char **av)
{
if (ac != 2)
{
std::cout << "usage: ./babel_server port" << std::endl;
return (0);
}
try
{
SocketManager sm((short) atoi(av[1]));
ASocket *newConnection;
UserManager um;
while (sm.Select() != -1)
{
um.handleSend(sm);
um.handleReceive(sm);
um.handlePendingAuth(sm);
newConnection = sm.tryNewConnection();
if (newConnection)
{
um.addPendingAuth(newConnection);
newConnection = NULL;
}
}
}
catch (const std::string &err)
{
std::cout << err << std::endl;
exit(1);
}
return (0);
}
开发者ID:CedLaPute,项目名称:cpp_babel,代码行数:34,代码来源:main.cpp
示例2: HandleUserSynch
void TaskSynch::HandleUserSynch(unsigned __int64 since, bool isResponse, unsigned long ip)
{
UserManager *pUserMan = m_pDataManager->GetUserManagerInstance();
User *pUser = pUserMan->FindUserFromIP(ip);
int len = 0;
if(pUser)
{
IterWrapper<Task> iter(pUser->IterateModifiedOrAssignedTasks(since));
char *pMsg = NULL;
Task *pTask = NULL;
while(iter.Next())
{
pTask= iter.Get();
unsigned long hashLen = 0;
StringBuffer sb(1024);
unsigned char *pSegHash = HashTaskTreeSeg(pTask->ToXMLString(sb), &hashLen);
#ifdef DEBUG
OutputDebugString(_T("Handle User Synch: "));
OutputDebugString(sb);
OutputDebugString(_T("\n"));
#endif
if(pSegHash)
{
pMsg = MakeTaskSynchTreeSegMsg(pSegHash, hashLen, pTask->GetID(), pTask->GetModifiedDate(), false, &len);
m_pNetwork->Send(pMsg, len, ip);
delete [] pSegHash;
}
}
}
if(!isResponse)
{
char *pMsg = MakeUserTaskSynchReq(0, true, &len);
m_pNetwork->Send(pMsg, len, ip);
}
}
开发者ID:jaylauffer,项目名称:loadngo,代码行数:35,代码来源:TaskSynch.cpp
示例3: printf
// TODO when is this invoked??
/*private static*/ void XN_CALLBACK_TYPE UserManager::onPoseDetected(xn::PoseDetectionCapability& capability, const XnChar* detectedPoseName, XnUserID userId, void* cookie) {
printf("UserManager.Pose %s detected for user %d\n", detectedPoseName, userId);
UserManager* tthis = static_cast<UserManager*>(cookie);
tthis->userGenerator.GetPoseDetectionCap().StopPoseDetection(userId);
tthis->userGenerator.GetSkeletonCap().RequestCalibration(userId, TRUE);
tthis->broadcastUserChangeState(userId, USER_STATE_POSE_DETECTED);
}
开发者ID:christophpickl,项目名称:ponyo-svn,代码行数:9,代码来源:UserManager.cpp
示例4: TestUMUpdate
void TestUMUpdate()
{
UserManager um;
User user;
user.name = "admin";
user.password = "12345";
user.authority = 1;
testLog->debug(um.updateCmd(user).toLocal8Bit().data());
testLog->debug(um.updateCmd(user).toLocal8Bit().data());
testLog->debug(um.updateCmd(user).toLocal8Bit().data());
testLog->debug(um.updateCmd(user).toLocal8Bit().data());
}
开发者ID:uwitec,项目名称:storesystem,代码行数:12,代码来源:TestUnit.cpp
示例5:
/*private static*/ void XN_CALLBACK_TYPE UserManager::onCalibrationEnd(xn::SkeletonCapability& capability, XnUserID userId, XnBool successfullyCalibrated, void* cookie) {
UserManager* tthis = static_cast<UserManager*>(cookie);
if (successfullyCalibrated) {
printf("Calibration complete, start tracking user %d\n", userId);
tthis->userGenerator.GetSkeletonCap().StartTracking(userId);
tthis->broadcastUserChangeState(userId, USER_STATE_CALIBRATION_ENDED_SUCCESFULLY);
} else {
printf("Calibration failed for user %d\n", userId);
tthis->userGenerator.GetSkeletonCap().RequestCalibration(userId, TRUE);
tthis->broadcastUserChangeState(userId, USER_STATE_CALIBRATION_ENDED_UNSUCCESFULLY);
}
}
开发者ID:christophpickl,项目名称:ponyo-svn,代码行数:13,代码来源:UserManager.cpp
示例6: comment
void CommentWindow::comment()
{
if (g_umUserManager.Comment(m_mvModel.m_sVideoID, m_qteComment->toPlainText().toStdString()) == SUCCESS)
{
g_umUserManager.GetLastVideo(m_mvModel);
emit updateModel(m_mvModel);
m_qteComment->clear();
m_qmbMsg->setText("Comment Successfully");
m_qmbMsg->setWindowModality(Qt::WindowModal);
m_qmbMsg->show();
connect(m_qmbMsg, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(toComment()));
}
开发者ID:aaronguo1996,项目名称:posture,代码行数:13,代码来源:commentwindow.cpp
示例7: Init
bool MainScene::Init()
{
// 获得用户
UserManager* userMgr = UserManager::getInstance();
// 启动子弹系统
BulletManager::getInstance()->startUp("Data/bulletConfig.lua");
// 启动道具系统
ItemManager::getInstance()->startUp("Data/itemConfig.lua");
// 启动飞机系统
PlaneManager::getInstance()->startUp("Data/planeConfig.lua");
// 启动特效系统
EffectManager::getInstance()->startUp("Data/effectConfig.lua");
// 调整摄像机的z轴位置
Camera::getInstance()->SetCameraPosition(0, 0, -600);
// 缓存音效
AudioManager* audioMgr = AudioManager::getInstance();
audioMgr->loadSoundForCache("Sound/se/beiji.ogg");
audioMgr->loadSoundForCache("Sound/se/boom.mp3");
audioMgr->loadSoundForCache("Sound/se/fly.ogg");
audioMgr->loadSoundForCache("Sound/se/get_item.mp3");
audioMgr->loadSoundForCache("Sound/se/missile.mp3");
audioMgr->loadSoundForCache("Sound/se/own_shoot1.ogg");
audioMgr->loadSoundForCache("Sound/se/own_shoot2.mp3");
audioMgr->loadSoundForCache("Sound/se/own_shoot3.ogg");
audioMgr->loadSoundForCache("Sound/se/se_warning.ogg");
// 初始化主角飞机
_own = Own::Create(userMgr->GetOwn());
_own->SetPosition(0, -150, 0);
Add(_own, LAYER_PLAYER);
// 分数
_scoreText = TextSprite::Create("SCORE:0", "微软雅黑", 16);
Add(_scoreText);
// 启动关卡系统
StageManager::getInstance()->startUp("Data/stage" + to_string(userMgr->GetStage()) + ".lua", this);
// 启动数据更新函数
AddUpdateFunc(UpdateFunc::Create(CALLBACK_PARAMETER_1(MainScene::UpdateData, this)));
EventDispatcher::getInstance()->Add(
KeyboardListener::Create(
this, KeyboardFunc::Create(
CALLBACK_PARAMETER_2(MainScene::onkey, this))));
return true;
}
开发者ID:Jenovez,项目名称:Frame2D-old,代码行数:49,代码来源:MainScene.cpp
示例8: toPosture
void Posture::toPosture(const QString &name)
{
if (modelList.size() == 0)
m_iListPage = 0;
if ((m_iListPage >= modelList.size() / MAXATONCE && modelList.size() % MAXATONCE == 0) ||
(modelList.size() % MAXATONCE != 0 && m_iListPage > modelList.size() / MAXATONCE))
{
if (name != "")
m_pmPageManager.GetModelByUserID(modelList, name.toStdString(), m_iListPage*MAXATONCE);
else
m_pmPageManager.GetModelByUserID(modelList, g_umUserManager.GetUsername(), m_iListPage*MAXATONCE);
}
int end = (m_iListPage + 1)*MAXATONCE < modelList.size() ? (m_iListPage + 1)*MAXATONCE : modelList.size();
m_iListPage = (end - 1) / MAXATONCE;
m_plwPosWin = new PostureListWindow(this, name, m_iListPage*MAXATONCE, end, modelList);
CloseCurrentWindow();
m_wtCurrentWin = POSTURELIST;
this->setCentralWidget(m_plwPosWin);
connect(m_plwPosWin, SIGNAL(toHome()), this, SLOT(toHomeWin()));
connect(m_plwPosWin, SIGNAL(toProfileMode(const QString&)), this, SLOT(toProfileMode(const QString&)));
connect(m_plwPosWin, SIGNAL(toUpload()), this, SLOT(toUploadMode()));
connect(m_plwPosWin, SIGNAL(logout()), this, SLOT(logout()));
connect(m_plwPosWin, SIGNAL(display(const ModelVideo&)), this, SLOT(toDisplay(const ModelVideo&)));
connect(m_plwPosWin, SIGNAL(prev(const QString&)), this, SLOT(prevList(const QString&)));
connect(m_plwPosWin, SIGNAL(next(const QString&)), this, SLOT(nextList(const QString&)));
}
开发者ID:aaronguo1996,项目名称:posture,代码行数:26,代码来源:posture.cpp
示例9: updateModel
void DisplayWindow::likeIt()
{
if (m_qpbLike->text() == "Like")
{
if (g_umUserManager.Commend(m_mvModel.m_sVideoID) == SUCCESS)
{
g_umUserManager.GetLastVideo(m_mvModel);
emit updateModel(m_mvModel);
m_qpbLike->setIcon(QIcon(g_sImgRoot + "liked.png"));
m_qpbLike->setText("Liked");
}
else
{
m_qlMsg->setText("Commend Fail, please try again.");
QTimer *timer = new QTimer();
timer->start(1000);
connect(timer, SIGNAL(timeout()), m_qwMessage, SLOT(close()));
connect(timer, SIGNAL(timeout()), timer, SLOT(stop()));
}
}
else if (m_qpbLike->text() == "Liked")
{
if (g_umUserManager.UnCommend(m_mvModel.m_sVideoID) == SUCCESS)
{
g_umUserManager.GetLastVideo(m_mvModel);
emit updateModel(m_mvModel);
m_qpbLike->setIcon(QIcon(g_sImgRoot + "like.png"));
m_qpbLike->setText("Like");
}
else
{
m_qlMsg->setText("Uncommend Fail, please try again.");
QTimer *timer = new QTimer();
timer->start(1000);
connect(timer, SIGNAL(timeout()), m_qwMessage, SLOT(close()));
connect(timer, SIGNAL(timeout()), timer, SLOT(stop()));
}
}
}
开发者ID:aaronguo1996,项目名称:posture,代码行数:41,代码来源:displaywindow.cpp
示例10: main
int main(int argc, char** argv) {
User u1("Ruben", "1234");
User u2("Pablo", "1234");
User u3("Pepe", "1234");
User u4("Juan", "1234");
UserManager userManager;
userManager.addUser(&u1);
userManager.addUser(&u2);
userManager.addUser(&u3);
userManager.addUser(&u4);
u1.addFriend(&u2);
u1.addFriend(&u3);
u1.addFriend(&u4);
userManager.showUsers();
userManager.searchForUser("Ruben", true)->showFriends();
userManager.addUser(&u3);
u1.addFriend(&u4);
cout << "-------------[ENDING SERVER]-------------" << endl;
return 0;
}
开发者ID:pablotomico,项目名称:ProjectP2P,代码行数:32,代码来源:main.cpp
示例11: logout
void Posture::logout()
{
g_umUserManager.Logout();
models.clear();
modelList.clear();
CloseCurrentWindow();
m_lwLogWin = new LogWindow(this,LOG);
this->setCentralWidget(m_lwLogWin);
connect(m_lwLogWin, SIGNAL(wait()), this, SLOT(message()));
connect(m_lwLogWin, SIGNAL(regSuccess()), this, SLOT(logout()));
m_wtCurrentWin = LOG;
this->setFixedSize(LOGWINDOW_W*xscale, LOGWINDOW_H*yscale);
}
开发者ID:aaronguo1996,项目名称:posture,代码行数:13,代码来源:posture.cpp
示例12: InitWidgets
void ProfileEditWindow::InitWidgets()
{
SourceManager sm;
UserPro up;
sm.GetUserProfile(up, g_umUserManager.GetUsername());
m_qlName = new QLabel("Username", m_qwBottomRight);
m_qlName->setObjectName("uploadInfo");
m_qlName->setFixedSize(UPLOADINFO_W*xscale, UPLOADINFO_H*yscale);
m_qleName = new QLineEdit(m_qwBottomRight);
m_qleName->setObjectName("editProfile");
m_qleName->setFixedSize(EDITPROFILE_W*xscale, EDITPROFILE_H*yscale);
m_qleName->setText(up.m_sUserName.c_str());
m_qleName->setReadOnly(true);
m_qlPwd = new QLabel("Password", m_qwBottomRight);
m_qlPwd->setObjectName("uploadInfo");
m_qlPwd->setFixedSize(UPLOADINFO_W*xscale, UPLOADINFO_H*yscale);
m_qlePwd = new QLineEdit(m_qwBottomRight);
m_qlePwd->setEchoMode(QLineEdit::Password);
m_qlePwd->setObjectName("editProfile");
m_qlePwd->setFixedSize(EDITPROFILE_W*xscale, EDITPROFILE_H*yscale);
m_qlPwdc = new QLabel("Password Confirm", m_qwBottomRight);
m_qlPwdc->setObjectName("uploadInfo");
m_qlPwdc->setFixedSize(UPLOADINFO_W*xscale, UPLOADINFO_H*yscale);
m_qlePwdc = new QLineEdit(m_qwBottomRight);
m_qlePwdc->setEchoMode(QLineEdit::Password);
m_qlePwdc->setObjectName("editProfile");
m_qlePwdc->setFixedSize(EDITPROFILE_W*xscale, EDITPROFILE_H*yscale);
m_qlEmail = new QLabel("Email", m_qwBottomRight);
m_qlEmail->setObjectName("uploadInfo");
m_qlEmail->setFixedSize(UPLOADINFO_W*xscale, UPLOADINFO_H*yscale);
m_qleEmail = new QLineEdit(m_qwBottomRight);
m_qleEmail->setText(up.m_sEmail.c_str());
m_qleEmail->setObjectName("editProfile");
m_qleEmail->setFixedSize(EDITPROFILE_W*xscale, EDITPROFILE_H*yscale);
m_qlError = new QLabel(m_qwBottomRight);
m_qpbCancel = new QPushButton("Cancel", m_qwBottomRight);
m_qpbCancel->setObjectName("detail");
m_qpbCancel->setFixedSize(DETAIL_W*xscale, DETAIL_H*yscale);
m_qpbSubmit = new QPushButton("Submit", m_qwBottomRight);
m_qpbSubmit->setObjectName("detail");
m_qpbSubmit->setFixedSize(DETAIL_W*xscale, DETAIL_H*yscale);
connect(m_qpbCancel, SIGNAL(clicked()), this, SLOT(cancel()));
connect(m_qpbSubmit, SIGNAL(clicked()), this, SLOT(submit()));
}
开发者ID:aaronguo1996,项目名称:posture,代码行数:49,代码来源:profileeditwindow.cpp
示例13: forwardIt
void DisplayWindow::forwardIt()
{
if (g_umUserManager.Share(m_mvModel.m_sVideoID) == SUCCESS)
{
m_qmbMsg->setWindowModality(Qt::WindowModal);
m_qmbMsg->setText("Forward successfully");
m_qmbMsg->show();
}
else
{
m_qmbMsg->setWindowModality(Qt::WindowModal);
m_qmbMsg->setText("Forward fail, please try it again later");
m_qmbMsg->show();
}
}
开发者ID:aaronguo1996,项目名称:posture,代码行数:15,代码来源:displaywindow.cpp
示例14: submit
void ProfileEditWindow::submit()
{
string pwd = m_qlePwd->text().toStdString();
string pwdc = m_qlePwdc->text().toStdString();
if (pwd == "" && pwdc == "")
{
pwd = g_sPwd.toStdString();
pwdc = g_sPwd.toStdString();
}
string email = m_qleEmail->text().toStdString();
int result = g_umUserManager.ChangeProfile(pwd, pwdc, email);
QString error;
switch (result)
{
case SUCCESS:
emit success("");
return;
case PWDNOTCON:
error = "the password is not Consistent!";
break;
case PWDTOOSIM:
error = "the password is too simple";
break;
case EMAILFAIL:
error = "the email address is not right";
break;
case EMPTYINFO:
error = "the information is empty";
break;
case PASSWORD2L:
error = "the password is too long";
break;
}
m_qlError->setText(error);
m_qlError->setObjectName("error");
m_qlError->setAlignment(Qt::AlignCenter);
m_qlError->show();
}
开发者ID:aaronguo1996,项目名称:posture,代码行数:40,代码来源:profileeditwindow.cpp
示例15: PEG_METHOD_ENTER
//.........这里部分代码省略.........
cimMethodName,
PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, ise.getMessage()));
PEG_METHOD_EXIT();
return;
}
#endif // #ifdef PEGASUS_ENABLE_USERGROUP_AUTHORIZATION
//
// Get a config manager instance
//
ConfigManager* configManager = ConfigManager::getInstance();
//
// Do namespace authorization verification
//
if (String::equalNoCase(
configManager->getCurrentValue("enableNamespaceAuthorization"),
"true"))
{
//
// If the user is not privileged, perform the authorization check.
//
#if !defined(PEGASUS_PLATFORM_OS400_ISERIES_IBM)
if ( ! System::isPrivilegedUser(userName) )
#else
// On OS/400, always check authorization if remote user.
// Always allow local privileged users through.
// Check authorization for local non-privileged users.
// (User authorization to providers are checked downstream from here).
if ( ! String::equalNoCase(authType,"Local") ||
! System::isPrivilegedUser(userName) )
#endif
{
UserManager* userManager = UserManager::getInstance();
if ( !userManager || !userManager->verifyAuthorization(
userName, nameSpace, cimMethodName) )
{
// l10n
// String description = "Not authorized to run ";
// description.append(cimMethodName);
// description.append(" in the namespace ");
// description.append(nameSpace.getString());
if (cimMethodName == "InvokeMethod")
{
// l10n
sendMethodError(
queueId,
req->getHttpMethod(),
req->messageId,
((CIMInvokeMethodRequestMessage*)req.get())->methodName,
PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED,
MessageLoaderParms(
"Server.CIMOperationRequestAuthorizer.NOT_AUTHORIZED",
"Not authorized to run $0 in the namespace $1",
cimMethodName, nameSpace.getString())));
}
else
{
// l10n
sendIMethodError(
queueId,
req->getHttpMethod(),
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:67,代码来源:CIMOperationRequestAuthorizer.cpp
示例16: GetElementList
void MainScene::UpdateData(const float& delta)
{
// 关卡数据更新
StageManager::getInstance()->Update(delta);
vector<Element*> list = GetElementList();
for (int i = 0; i < list.size(); ++i)
{
list.at(i)->SetPositionZ(-list.at(i)->GetOrder() * 2);
if (list.at(i)->GetOrder() == LAYER_PLAYER_BULLET ||
list.at(i)->GetOrder() == LAYER_ENEMY_BULLET)
{
RECT viewRect = Director::getInstance()->GetViewRect();
D3DXVECTOR3 viewPos = Camera::getInstance()->GetViewPosition();
if (Tools::CheckHit_UnInclude(list.at(i),
viewPos.x - viewRect.right / 2.0f,
viewPos.y - viewRect.bottom / 2.0f,
viewPos.x + viewRect.right / 2.0f,
viewPos.y + viewRect.bottom / 2.0f))
{
list.at(i)->SetVisible(false);
}
}
else if (list.at(i)->GetOrder() == LAYER_ENEMY_1 ||
list.at(i)->GetOrder() == LAYER_ENEMY_2 ||
list.at(i)->GetOrder() == LAYER_ENEMY_3)
{
RECT viewRect = Director::getInstance()->GetViewRect();
D3DXVECTOR3 viewPos = Camera::getInstance()->GetViewPosition();
if (list.at(i)->GetPositionY() + (0.5f - list.at(i)->GetAnchorY()) * list.at(i)->GetHeight() <
viewPos.y + viewRect.bottom / 2.0f &&
list.at(i)->GetPositionY() - (0.5f - list.at(i)->GetAnchorY()) * list.at(i)->GetHeight() >
viewPos.y - viewRect.bottom / 2.0f)
{
for (int j = 0; j < list.size(); ++j)
{
if (list.at(j)->GetOrder() == LAYER_PLAYER_BULLET)
{
if (Tools::CheckHit_Circle(list.at(j), list.at(i)) && ((Enemy*)list.at(i))->GetHp() > 0)
{
Bullet* bullet = (Bullet*)list.at(j);
if (bullet->IsCross() == false)
{
bullet->Die();
}
Enemy* enemy = (Enemy*)list.at(i);
enemy->SetHp(enemy->GetHp() - bullet->GetAttack());
enemy->SetBruiseEnable(true);
if (enemy->GetHp() <= 0)
{
enemy->Die();
//分数更新
UserManager* userMgr = UserManager::getInstance();
userMgr->SetScore(userMgr->GetScore() + enemy->GetScore());
enemy->SetScore(0);
_scoreText->SetText("SCORE:" + to_string(userMgr->GetScore()));
if (enemy->GetName().substr(0, 4).compare("boss") == 0)
{
if (userMgr->GetStage() < userMgr->GetStageMax())
{
userMgr->SetStage(userMgr->GetStage() + 1);
if (_black == 0)
{
_black = Sprite::Create("Res/Login/black.png");
_black->SetScale(500);
Add(_black);
ClearUpdateFunc();
AddUpdateFunc(UpdateFunc::Create(CALLBACK_PARAMETER_1(MainScene::Fade, this)));
AudioManager::getInstance()->stopBGM();
AudioManager::getInstance()->playSoundEffect("Sound/se/clear.mp3");
return;
}
}
else
{
}
}
}
else
{
Effect* boom = Effect::Create("fire1");
boom->SetTextureBlend(true);
boom->SetPosition(bullet->GetPositionX(), bullet->GetPositionY(), bullet->GetPositionZ());
boom->SetOrder(LAYER_ENEMY_BOOM);
Add(boom);
AudioManager::getInstance()->playSoundEffect("Sound/se/beiji.ogg");
}
}
}
}
}
else if (Tools::CheckHit_UnInclude(list.at(i),
viewPos.x - viewRect.right / 2.0f - 300,
viewPos.y - viewRect.bottom / 2.0f - 300,
viewPos.x + viewRect.right / 2.0f + 300,
viewPos.y + viewRect.bottom / 2.0f + 300))
//.........这里部分代码省略.........
开发者ID:Jenovez,项目名称:Frame2D-old,代码行数:101,代码来源:MainScene.cpp
示例17: QHBoxLayout
void DisplayWindow::BuildBottomRight()
{
QHBoxLayout *mainLayout = new QHBoxLayout();
QVBoxLayout *rightLayout = new QVBoxLayout();
m_qlOutline = new QLabel(QString(m_mvModel.m_sOutLine.c_str()), this);
m_qlOutline->setObjectName("displayOutline");
m_qlOutline->setWordWrap(true);
m_qlOutline->setMinimumSize(DISPLAYOUTLINE_W*xscale, DISPLAYOUTLINE_H*yscale);
rightLayout->addStretch();
rightLayout->addWidget(m_qlOutline);
rightLayout->addSpacing(SPACE);
QHBoxLayout *favorLayout = new QHBoxLayout();
srand(time(NULL));
m_qpbTag = new QPushButton(m_mvModel.m_sFavor.c_str(), this);//[TODO] change the fixed favor into the info of the video
m_qpbTag->setObjectName("tag");
m_qpbTag->setFixedSize(TAG_W*xscale, TAG_H*yscale);
m_qpbTag->setStyleSheet(QString("background-color:rgba(%1,%2,%3,0.5)")
.arg(rand() % 255).arg(rand() % 255).arg(rand() % 255));
if (QString(m_mvModel.m_sFavor.c_str()) == "")
m_qpbTag->hide();
favorLayout->addWidget(m_qpbTag);
favorLayout->addStretch();
rightLayout->addLayout(favorLayout);
QHBoxLayout *funcLayout = new QHBoxLayout();
m_qpbLike = new QPushButton("Like", this);
m_qpbLike->setObjectName("like");
m_qpbLike->setFixedSize(LIKE_W*xscale, LIKE_H*yscale);
if (m_mvModel.ifCommend(g_umUserManager.GetUsername()))
{
m_qpbLike->setIcon(QIcon(g_sImgRoot + "liked.png"));
m_qpbLike->setText("Liked");
}
else
m_qpbLike->setIcon(QIcon(g_sImgRoot + "like.png"));
m_qpbLike->setIconSize(QSize(ICONWIDTH*xscale/2, ICONHEIGHT*yscale/2));
m_qpbForward = new QPushButton("Forward", this);
m_qpbForward->setObjectName("like");
m_qpbForward->setFixedSize(LIKE_W*xscale, LIKE_H*yscale);
m_qpbForward->setIcon(QIcon(g_sImgRoot + "forward.png"));
m_qpbForward->setIconSize(QSize(ICONWIDTH*xscale / 2, ICONHEIGHT*yscale / 2));
if (m_mvModel.m_sPublisher == g_umUserManager.GetUsername())
m_qpbForward->hide();
m_qpbComment = new QPushButton("Comment", this);
m_qpbComment->setObjectName("like");
m_qpbComment->setFixedSize(LIKE_W*xscale, LIKE_H*yscale);
m_qpbComment->setIcon(QIcon(g_sImgRoot + "comment.png"));
m_qpbComment->setIconSize(QSize(ICONWIDTH*xscale / 2, ICONHEIGHT*yscale / 2));
funcLayout->addStretch();
funcLayout->addWidget(m_qpbLike);
funcLayout->addWidget(m_qpbForward);
funcLayout->addWidget(m_qpbComment);
funcLayout->addSpacing(SPACE);
//m_dwDisplay = new DisplayWidget("display/demo.ms3d", "1", m_qwBottomRight);
m_dwDisplay = new DisplayWidget(g_sModel + QString(m_mvModel.m_sVideoID.c_str()),m_mvModel.m_sMode.c_str(), m_qwBottomRight);
m_dwDisplay->setObjectName("display");
m_dwDisplay->setFixedSize(DISPLAY_W*xscale, DISPLAY_H*yscale);
m_qlUser = new QLabel("Uploader: ", m_qwBottomRight);
m_qlUser->setObjectName("name");
m_qlUser->setFixedSize(NAME_W*3*xscale, NAME_H*yscale);
m_qpbUser = new QPushButton(m_mvModel.m_sPublisher.c_str(), m_qwBottomRight);
m_qpbUser->setObjectName("toProfile");
m_qpbUser->setFixedSize(TOPROFILE_W*xscale, TOPROFILE_H*yscale);
m_qtbDesc = new QTextBrowser(this);
m_qtbDesc->setObjectName("desc");
m_qtbDesc->setFixedSize(DESC_W*xscale, DESC_H*yscale);
m_qtbDesc->setText(QString("Description: ") + m_mvModel.m_sDescribe.c_str());
QHBoxLayout *nameLayout = new QHBoxLayout();
nameLayout->addWidget(m_qlUser);
nameLayout->addWidget(m_qpbUser);
nameLayout->addStretch();
rightLayout->addStretch();
rightLayout->addLayout(nameLayout);
rightLayout->addWidget(m_qtbDesc);
rightLayout->addStretch();
rightLayout->addLayout(funcLayout);
rightLayout->addStretch();
mainLayout->addWidget(m_dwDisplay);
mainLayout->addSpacing(SPACE);
mainLayout->addLayout(rightLayout);
m_qwBottomRight->setLayout(mainLayout);
}
开发者ID:aaronguo1996,项目名称:posture,代码行数:86,代码来源:displaywindow.cpp
示例18: TestUMSearch
void TestUMSearch()
{
UserManager um;
testLog->debug(um.searchCmd("admin").toLocal8Bit().data());
}
开发者ID:uwitec,项目名称:storesystem,代码行数:5,代码来源:TestUnit.cpp
示例19: TestUMLogin
void TestUMLogin()
{
UserManager um;
testLog->debug(um.loginCmd("admin", "12345").toLocal8Bit().data());
}
开发者ID:uwitec,项目名称:storesystem,代码行数:5,代码来源:TestUnit.cpp
示例20: main
//
// main
//
int main(int argc, char** argv)
{
verbose = (getenv ("PEGASUS_TEST_VERBOSE")) ? true : false;
if (verbose) cout << argv[0] << ": started" << endl;
CIMNamespaceName nameSpace;
String testUser = System::getEffectiveUserName();
// Create a test repository
const char* tmpDir = getenv ("PEGASUS_TMP");
String repositoryPath;
if (tmpDir == NULL)
{
repositoryPath = ".";
}
else
{
repositoryPath = tmpDir;
}
repositoryPath.append("/repository");
FileSystem::removeDirectoryHier(repositoryPath);
CIMRepository* repository = new CIMRepository(repositoryPath);
// -- Create a UserManager object:
UserManager* userManager = UserManager::getInstance(repository);
//
// Test authorization
//
try
{
nameSpace = BAD_NAMESPACE;
PEGASUS_TEST_ASSERT(!userManager->verifyNamespace(nameSpace));
nameSpace = GOOD_NAMESPACE;
PEGASUS_TEST_ASSERT(!userManager->verifyNamespace(nameSpace));
userManager->setAuthorization(testUser, nameSpace, "rw");
userManager->setAuthorization("root", nameSpace, "w");
String temp = userManager->getAuthorization(testUser, nameSpace);
if (testUser != "root")
PEGASUS_TEST_ASSERT(
String::equal(temp, "rw") || String::equal(temp, "wr"));
temp = userManager->getAuthorization("root", nameSpace);
PEGASUS_TEST_ASSERT(String::equal(temp, "w"));
userManager->removeAuthorization("root", nameSpace);
temp.clear();
try
{
temp = userManager->getAuthorization("root", nameSpace);
PEGASUS_TEST_ASSERT(temp.size() == 0);
}catch(const Exception&) { }
userManager->setAuthorization("root", nameSpace, "w");
if (testUser != "root")
PEGASUS_TEST_ASSERT(userManager->verifyAuthorization(
testUser, nameSpace, CIMName("GetInstance")));
PEGASUS_TEST_ASSERT(!userManager->verifyAuthorization(
"root", nameSpace, CIMName("GetInstance")));
userManager->setAuthorization("root", nameSpace, "r");
PEGASUS_TEST_ASSERT(!userManager->verifyAuthorization(
"root", nameSpace, CIMName("SetProperty")));
userManager->removeAuthorization("root", nameSpace);
if (testUser != "root")
userManager->removeAuthorization(testUser, nameSpace);
}
catch(Exception& e)
{
cout << argv[0] << " Exception: " << e.getMessage() << endl;
PEGASUS_TEST_ASSERT(0);
}
UserManager::destroy();
delete repository;
FileSystem::removeDirectoryHier(repositoryPath);
cout << argv[0] << " +++++ passed all tests" << endl;
return 0;
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:94,代码来源:AuthorizationHandler.cpp
注:本文中的UserManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论