AdminMainWidget::AdminMainWidget(LinQedInAdmin* ad,QWidget* parent):QFrame(parent),admin(ad){ setAttribute(Qt::WA_DeleteOnClose); setStyleSheet(GUIStyle::generalStyle()); mainVerticalLayout=new QVBoxLayout; logo=new QLabel; GUIStyle::initLogo(logo); mainVerticalLayout->addWidget(logo,0,Qt::AlignRight); loggedAsAdmin=new QLabel(tr("Modalità amministratore")); loggedAsAdmin->setStyleSheet(GUIStyle::headerStyle()); mainVerticalLayout->addWidget(loggedAsAdmin,0,Qt::AlignCenter); mainVerticalLayout->addSpacing(15); searchLayout=new QHBoxLayout; initUsernameSearch(); users=new QListWidget; users->setHidden(true); users->setEditTriggers(users->NoEditTriggers); users->setSelectionMode(QAbstractItemView::NoSelection); users->setMinimumWidth(450); users->setMinimumHeight(430); users->setStyleSheet("QListWidget{"+GUIStyle::borderStyle()+"padding:20px;padding-top:5px;}"); searchLayout->addWidget(users,5,Qt::AlignHCenter | Qt::AlignTop); initNameSurnameSearch(); mainVerticalLayout->addLayout(searchLayout); noUsers=new QLabel(tr("Nessun utente nel DB")); noUsers->setStyleSheet(GUIStyle::errorLabelStyle()); mainVerticalLayout->addWidget(noUsers,0,Qt::AlignCenter); buttonsLayout=new QHBoxLayout; save=new QPushButton(tr("Salva modifiche al DB")); save->setCursor(QCursor(Qt::PointingHandCursor)); save->setMaximumWidth(buttonsMaxWidth); connect(save,SIGNAL(clicked()),this,SLOT(saveDB())); buttonsLayout->addWidget(save,0,Qt::AlignCenter); add=new QPushButton(tr("Aggiungi un nuovo utente")); add->setCursor(QCursor(Qt::PointingHandCursor)); add->setMaximumWidth(buttonsMaxWidth); connect(add,SIGNAL(clicked()),this,SLOT(addUserRequest())); buttonsLayout->addWidget(add,0,Qt::AlignCenter); logout=new QPushButton(tr("Logout")); logout->setCursor(QCursor(Qt::PointingHandCursor)); connect(logout,SIGNAL(clicked()),this,SLOT(logoutRequest())); logout->setMaximumWidth(buttonsMaxWidth); buttonsLayout->addWidget(logout,0,Qt::AlignCenter); mainVerticalLayout->addLayout(buttonsLayout); populateList(admin->allUsers()); setLayout(mainVerticalLayout); QShortcut *save=new QShortcut(QKeySequence("Ctrl+S"),this); connect(save,SIGNAL(activated()),this,SLOT(saveDB())); }//AdminMainWidget
void closeUndo(EdStruct *xx, DBInfo *db) /* * Start recording undo for next command */ { if (--_DBI_open_undo_count(db) != 0) return; if (!_DBI_store_undo(db)) return; if (_DBI_num_undo(db) > 0 && _DBI_undo_lists(db)[_DBI_last_undo(db)] == NULL){ _DBI_last_undo(db) = (_DBI_last_undo(db) + MAX_SAVE_EDITS - 1) % MAX_SAVE_EDITS; _DBI_num_undo(db)--; if (--_DBI_edits_made(db) < 0) { _DBI_edits_made(db) = 0; } } if (xx->auto_save && _DBI_edits_made(db) >= AUTO_SAVE_EDITS) { vmessage("Contig Editor: auto saving\n"); UpdateTextOutput(); saveDB(xx, _DBI_io(db), 1 /* an autosave */, 1 /* notify others */); } }
void MainWindow::saveAs() { QString saveDBName = QFileDialog::getSaveFileName(this, tr("Save database"), QFileInfo(current_db_file).fileName(), tr("iTest databases (*.itdb)")); if (!saveDBName.isNull() || !saveDBName.isEmpty()) { addRecent(saveDBName); saveDB(saveDBName); } }
int main(int argc, char ** argv) { // array of type Student Student *s = malloc(sizeof(Student) * 100); // zero the newly allocated memory memset(s, 0, sizeof(Student)*100); int menuOpt; int terminateflag = 0; while (!terminateflag) { menuOpt = menu(); switch (menuOpt){ case 1: // Module that handles entering the student's basic information (name, email, UID#) newStudent(s); break; case 2: // Module that loads a database file into memory. loadDB(s); break; case 3: // Module that saves the database to a file saveDB(s); break; case 4: // Module that searches for a student in the database viewStudent(s); break; case 5: // Module that allows the user to enter a grade enterGrades(s); break; case 6: // Delete a student deleteStudent(s); break; case 7: // Exit terminateflag = 1; break; default: printf("Please enter a valid option number.\n\n"); break; } } return 0; }
int main() { int choice; init_mass_struct(); for(;;) { printf("Hello, user. What do you want?\n\n"); printf("1. Create new DB.\n"); printf("2. Add record.\n"); printf("3. Delete record.\n"); printf("4. Sort DB.\n"); printf("5. Save DB.\n"); printf("6. Load DB.\n"); printf("0. Exit.\n"); scanf("%d", &choice); switch (choice) { case 1: createDB(); break; case 2: addRecord(); break; case 3: deleteRecord(); break; case 4: sortDB(); break; case 5: saveDB(); break; case 6: loadDB(); break; case 0: system("cls"); printf("Bye-bye, user."); return 0; break; default: system("cls"); printf("Error! Please, enter correct menu number, or 0 to exit.\n\n"); break; } } return 0; }
void MainWindow::saveCopy() { if (this->isWindowModified()) { switch (QMessageBox::information(this, tr("Save a copy"), tr("It is necessary to save any changes you have made to the database before proceeding."), tr("&Save"), tr("Cancel"), 0, 1)) { case 0: // Save save(); break; case 1: // Cancel return; break; } } QString saveDBName = QFileDialog::getSaveFileName(this, tr("Save a copy"), QFileInfo(current_db_file).fileName(), tr("iTest databases (*.itdb);;iTest 1.3 databases (*.it13.itdb)")); if (!saveDBName.isNull() || !saveDBName.isEmpty()) { addRecent(saveDBName); saveDB(saveDBName, true); } }
void AdminInterface_Controller::connetti() const { connect( view, SIGNAL( requestToSearchUsers() ), this, SLOT( setSearchWindow() ) ); connect( view, SIGNAL( requestToAddUser() ), this, SLOT( setInsertWindow() ) ); connect( view, SIGNAL( requestToViewUsers() ), this, SLOT( viewUsers() ) ); connect( view, SIGNAL( requestToViewUser( const QString &) ), this, SLOT( setUserWindow( const QString & ) ) ); connect( this, SIGNAL( updateListUsers( const QVector<smartptr_utente> & ) ), view, SIGNAL( updateTable( const QVector<smartptr_utente> & ) ) ); connect( view, SIGNAL( requestToRemoveUser() ), this, SLOT( removeUserSelected() ) ); connect( view, SIGNAL( requestToSaveDB() ), this, SLOT( saveDB() ) ); connect( view, SIGNAL( requestToLoadDB() ), this, SLOT( loadDB() ) ); }
void joinDB(EdStruct *xx[2], GapIO *io) { int relx; int i; int cl, cr; cl = DBI_contigNum(xx[0]); cr = DBI_contigNum(xx[1]); /* * Save an internal databases */ for (i=0;i<2;i++) saveDB(xx[i], io, 0, 0 /* no notify (done by dojoin) */); relx = editorLockedPos(xx, 1/*force*/); if (relx<0) { dojoin(io, cl, cr, -relx); } else { dojoin(io, cr, cl, relx); } }
void MainWindow::save() { saveDB(current_db_file); }