void Adresis::createUser(const XMLResults& result) { D_FUNCINFO; ADUser user; user.setValues(result); emit showUser(user); }
VimeoUsersWindow::VimeoUsersWindow(StackedWindow *parent) : StackedWindow(parent), m_model(new VimeoUserModel(this)), m_cache(new ImageCache), m_view(new ListView(this)), m_delegate(new UserDelegate(m_cache, VimeoUserModel::SubscriberCountRole, VimeoUserModel::ThumbnailUrlRole, VimeoUserModel::UsernameRole, m_view)), m_viewGroup(new QActionGroup(this)), m_listAction(new QAction(tr("List"), this)), m_gridAction(new QAction(tr("Grid"), this)), m_reloadAction(new QAction(tr("Reload"), this)), m_label(new QLabel(QString("<p align='center'; style='font-size: 40px; color: %1'>%2</p>") .arg(palette().color(QPalette::Mid).name()).arg(tr("No users found")), this)) { setWindowTitle(tr("Users")); setCentralWidget(new QWidget); m_view->setModel(m_model); m_view->setItemDelegate(m_delegate); m_listAction->setCheckable(true); m_listAction->setChecked(true); m_gridAction->setCheckable(true); m_viewGroup->setExclusive(true); m_viewGroup->addAction(m_listAction); m_viewGroup->addAction(m_gridAction); m_reloadAction->setEnabled(false); m_label->hide(); m_layout = new QVBoxLayout(centralWidget()); m_layout->addWidget(m_view); m_layout->addWidget(m_label); m_layout->setContentsMargins(0, 0, 0, 0); menuBar()->addAction(m_listAction); menuBar()->addAction(m_gridAction); menuBar()->addAction(m_reloadAction); connect(m_model, SIGNAL(statusChanged(QVimeo::ResourcesRequest::Status)), this, SLOT(onModelStatusChanged(QVimeo::ResourcesRequest::Status))); connect(m_cache, SIGNAL(imageReady()), this, SLOT(onImageReady())); connect(m_view, SIGNAL(activated(QModelIndex)), this, SLOT(showUser(QModelIndex))); connect(m_listAction, SIGNAL(triggered()), this, SLOT(enableListMode())); connect(m_gridAction, SIGNAL(triggered()), this, SLOT(enableGridMode())); connect(m_reloadAction, SIGNAL(triggered()), m_model, SLOT(reload())); if (Settings::instance()->defaultViewMode() == "grid") { m_gridAction->trigger(); } }
void Gui_AdminWindow::createUserList() { list<SmartPtr<User> > l = _admin->listUsers(); for(list<SmartPtr<User> >::iterator it = l.begin(); it != l.end(); ++it) { QListWidgetItem* item = new QListWidgetItem; item->setData(Qt::DisplayRole, QString::fromStdString((*it)->account()->username().login())); if(!(*it)->account()->lastPayment()->approvation()) { item->setData(Qt::DecorationRole, QPixmap("img/arrow106.png")); item->setData(Qt::UserRole + 3, 1); item->setData(Qt::UserRole + 4, QString::number((*it)->account()->lastPayment()->subscription()->level())); } else item->setData(Qt::DecorationRole, QPixmap("img/profile11.png")); item->setData(Qt::UserRole + 1, QString::fromStdString((*it)->showInfo())); item->setData(Qt::UserRole + 2, QString::fromStdString((*it)->account()->username().login())); _userList->addItem(item); } connect(_userList, SIGNAL(clicked(QModelIndex)), this, SLOT(showUser())); }
STStatusPane::STStatusPane(quint64 statusID, STAccount *account, QGraphicsItem *parent) : STPane(parent), m_account(account),m_statusId(statusID) { m_contentsView=new STStatusContentsView(this); m_nameView=new STStatusUserNameView(contentsView()); connect(m_nameView, SIGNAL(linkActivated(STObjectManager::EntityRange*, STObjectManager::LinkActivationInfo)), this, SLOT(linkActivate(STObjectManager::EntityRange*, STObjectManager::LinkActivationInfo))); m_iconView=new STUserIconView(STObjectManager::UserRef(), contentsView()); m_iconView->setSize(QSize(36,36)); m_iconView->setAcceptedMouseButtons(Qt::LeftButton); m_iconView->setCursor(Qt::PointingHandCursor); connect(m_iconView, SIGNAL(clicked()), this, SLOT(showUser())); }
void MainWindow::on_pushButtonLogIn_clicked() { QString user = ui->lineEditUser->text(); QString pwd = ui->lineEditPassword->text(); DbHelper *dbhelper = new DbHelper(); if (user == "" || pwd == "") { QMessageBox::warning(NULL, tr("Warning!"), tr("User name and password cannot be null!")); } else if (dbhelper->queryOne(user, pwd)) { if (user == "admin") { QMessageBox::information(NULL, tr("Welcome!"), tr("Your are a manager!")); manager.show(); } else { QMessageBox::information(NULL, tr("Welcome!"), tr("Your are a user!")); userView->show(); } } connect(this, SIGNAL(emitUser(QString,QString)), userView, SLOT(showUser(QString,QString))); emit emitUser(user, pwd); }
void MainWindow::on_pushButtonSignUp_clicked() { QString user = ui->lineEditUser->text(); QString pwd = ui->lineEditPassword->text(); DbHelper *dbhelper = new DbHelper(); if (user == "" || pwd == "") { QMessageBox::warning(NULL, tr("Warning!"), tr("User name and password cannot be null!")); } else if (dbhelper->queryOne(user, pwd)) { QMessageBox::warning(NULL, tr("Warning!"), tr("User name have exited!")); } else { if (dbhelper->addOne(user, pwd)){ QMessageBox::information(NULL, tr("Welcome!"), tr("You have been a user!")); userView->show(); } else { QMessageBox::warning(NULL, tr("Wrong!"), tr("Sorry, database wrong!")); } connect(this, SIGNAL(emitUser(QString,QString)), userView, SLOT(showUser(QString,QString))); emit emitUser(user, pwd); } }
/* handle a command, return code is 0 if the command was (at least partially) valid, -1 for quitting, -2 for if invalid -3 if empty. */ int doCommand(char *cmdToken[]) { int wild, doLs; if (strcmp(cmdToken[0],"help")==0 || strcmp(cmdToken[0],"h") == 0) { usage(cmdToken[1]); return(0); } if (strcmp(cmdToken[0],"quit")==0 || strcmp(cmdToken[0],"q") == 0) { return(-1); } handleMinusL(cmdToken[1]); handleMinusL(cmdToken[2]); if (strcmp(cmdToken[1],"-C")==0) cmdToken[1][1]='c'; if (strcmp(cmdToken[1],"-D")==0) cmdToken[1][1]='d'; if (strcmp(cmdToken[1],"-R")==0) cmdToken[1][1]='r'; if (strcmp(cmdToken[1],"-G")==0) cmdToken[1][1]='g'; if (strcmp(cmdToken[2],"-C")==0) cmdToken[2][1]='c'; if (strcmp(cmdToken[2],"-D")==0) cmdToken[2][1]='d'; if (strcmp(cmdToken[2],"-R")==0) cmdToken[2][1]='r'; if (strcmp(cmdToken[2],"-G")==0) cmdToken[2][1]='g'; if (strcmp(cmdToken[0],"adda") == 0) { modAVUMetadata("adda", cmdToken[1], cmdToken[2], cmdToken[3], cmdToken[4], cmdToken[5], cmdToken[6], cmdToken[7], ""); return(0); } if (strcmp(cmdToken[0],"add") == 0) { modAVUMetadata("add", cmdToken[1], cmdToken[2], cmdToken[3], cmdToken[4], cmdToken[5], cmdToken[6], cmdToken[7], ""); return(0); } if (strcmp(cmdToken[0],"addw") == 0) { int myStat; myStat = modAVUMetadata("addw", cmdToken[1], cmdToken[2], cmdToken[3], cmdToken[4], cmdToken[5], cmdToken[6], cmdToken[7], ""); if (myStat > 0) { printf("AVU added to %d data-objects\n", myStat); lastCommandStatus = 0; } return(0); } if (strcmp(cmdToken[0],"rmw") == 0) { modAVUMetadata("rmw", cmdToken[1], cmdToken[2], cmdToken[3], cmdToken[4], cmdToken[5], cmdToken[6], cmdToken[7], ""); return(0); } if (strcmp(cmdToken[0],"rm") == 0) { modAVUMetadata("rm", cmdToken[1], cmdToken[2], cmdToken[3], cmdToken[4], cmdToken[5], cmdToken[6], cmdToken[7], ""); return(0); } if (testMode) { if (strcmp(cmdToken[0],"rmi") == 0) { modAVUMetadata("rmi", cmdToken[1], cmdToken[2], cmdToken[3], cmdToken[4], cmdToken[5], cmdToken[6], cmdToken[7], ""); return(0); } } if (strcmp(cmdToken[0],"mod") == 0) { modAVUMetadata("mod", cmdToken[1], cmdToken[2], cmdToken[3], cmdToken[4], cmdToken[5], cmdToken[6], cmdToken[7], cmdToken[8]); return(0); } if (strcmp(cmdToken[0],"set") == 0) { modAVUMetadata("set", cmdToken[1], cmdToken[2], cmdToken[3], cmdToken[4], cmdToken[5], cmdToken[6], cmdToken[7], ""); return(0); } doLs=0; if (strcmp(cmdToken[0],"lsw") == 0) { doLs=1; wild=1; } if (strcmp(cmdToken[0],"ls") == 0) { doLs=1; wild=0; } if (doLs) { if (strcmp(cmdToken[1],"-d")==0) { showDataObj(cmdToken[2], cmdToken[3], wild); return(0); } if (strcmp(cmdToken[1],"-C")==0 || strcmp(cmdToken[1],"-c")==0) { showColl(cmdToken[2], cmdToken[3], wild); return(0); } if (strcmp(cmdToken[1],"-R")==0 || strcmp(cmdToken[1],"-r")==0) { showResc(cmdToken[2], cmdToken[3], wild); return(0); } if (strcmp(cmdToken[1],"-G")==0 || strcmp(cmdToken[1],"-g")==0) { showRescGroup(cmdToken[2], cmdToken[3], wild); return(0); } if (strcmp(cmdToken[1],"-u")==0) { showUser(cmdToken[2], cmdToken[3], wild); return(0); } } if (strcmp(cmdToken[0],"qu") == 0) { if (strcmp(cmdToken[1],"-d")==0) { queryDataObj(cmdToken); return(0); } if (strcmp(cmdToken[1],"-C")==0 || strcmp(cmdToken[1],"-c")==0) { queryCollection(cmdToken); return(0); } if (strcmp(cmdToken[1],"-R")==0 || strcmp(cmdToken[1],"-r")==0) { queryResc(cmdToken[2], cmdToken[3], cmdToken[4]); return(0); } if (strcmp(cmdToken[1],"-G")==0 || strcmp(cmdToken[1],"-g")==0) { queryRescGroup(cmdToken[2], cmdToken[3], cmdToken[4]); return(0); } if (strcmp(cmdToken[1],"-u")==0) { queryUser(cmdToken[2], cmdToken[3], cmdToken[4]); return(0); } } if (strcmp(cmdToken[0],"cp") == 0) { modCopyAVUMetadata("cp", cmdToken[1], cmdToken[2], cmdToken[3], cmdToken[4], cmdToken[5], cmdToken[6], cmdToken[7]); return(0); } if (strcmp(cmdToken[0],"test") == 0) { if (testMode) { testMode=0; printf("testMode is now off\n"); } else { testMode=1; printf("testMode is now on\n"); } return(0); } if (*cmdToken[0] != '\0') { printf("unrecognized command, try 'help'\n"); return(-2); } return(-3); }
int main( int argc, char **argv ) { signal( SIGPIPE, SIG_IGN ); int status, nArgs; rErrMsg_t errMsg; rodsArguments_t myRodsArgs; rodsLogLevel( LOG_ERROR ); status = parseCmdLineOpt( argc, argv, "vVh", 0, &myRodsArgs ); if ( status ) { printf( "Use -h for help.\n" ); exit( 1 ); } if ( myRodsArgs.help == True ) { usage(); exit( 0 ); } status = getRodsEnv( &myEnv ); if ( status < 0 ) { rodsLog( LOG_ERROR, "main: getRodsEnv error. status = %d", status ); exit( 1 ); } // =-=-=-=-=-=-=- // initialize pluggable api table irods::api_entry_table& api_tbl = irods::get_client_api_table(); irods::pack_entry_table& pk_tbl = irods::get_pack_table(); init_api_table( api_tbl, pk_tbl ); Conn = rcConnect( myEnv.rodsHost, myEnv.rodsPort, myEnv.rodsUserName, myEnv.rodsZone, 0, &errMsg ); if ( Conn == NULL ) { exit( 2 ); } status = clientLogin( Conn ); if ( status != 0 ) { if ( !debug ) { exit( 3 ); } } nArgs = argc - myRodsArgs.optind; if ( nArgs == 1 ) { status = showUser(argv[myRodsArgs.optind]); } else { const auto user_name{(boost::format("%s#%s") % myEnv.rodsUserName % myEnv.rodsZone).str().c_str()}; status = showUser(user_name); } printErrorStack( Conn->rError ); rcDisconnect( Conn ); exit( status ); }