VLCProfileSelector::VLCProfileSelector( QWidget *_parent ): QWidget( _parent ) { QHBoxLayout *layout = new QHBoxLayout( this ); QLabel *prLabel = new QLabel( qtr( "Profile"), this ); layout->addWidget( prLabel ); profileBox = new QComboBox( this ); layout->addWidget( profileBox ); QToolButton *editButton = new QToolButton( this ); editButton->setIcon( QIcon( ":/menu/preferences" ) ); editButton->setToolTip( qtr( "Edit selected profile" ) ); layout->addWidget( editButton ); QToolButton *deleteButton = new QToolButton( this ); deleteButton->setIcon( QIcon( ":/toolbar/clear" ) ); deleteButton->setToolTip( qtr( "Delete selected profile" ) ); layout->addWidget( deleteButton ); QToolButton *newButton = new QToolButton( this ); newButton->setIcon( QIcon( ":/new" ) ); newButton->setToolTip( qtr( "Create a new profile" ) ); layout->addWidget(newButton); BUTTONACT( newButton, newProfile() ); BUTTONACT( editButton, editProfile() ); BUTTONACT( deleteButton, deleteProfile() ); fillProfilesCombo(); CONNECT( profileBox, activated( int ), this, updateOptions( int ) ); updateOptions( 0 ); }
ProfileSelect::ProfileSelect(QWidget *parent) : QDialog(parent), ui(new Ui::ProfileSelect) { ui->setupUi(this); QStringList str; model=new QStandardItemModel (0,0); int i=0; int sel=-1; QString name; QIcon icon(":/icons/moon.png"); for (QMap<QString,Profile *>::iterator p=Profiles::profiles.begin();p!=Profiles::profiles.end();p++) { name=p.key(); QStandardItem *item=new QStandardItem(icon,name); if (PREF.contains(STR_GEN_Profile) && (name==PREF[STR_GEN_Profile].toString())) { sel=i; } item->setData(p.key()); item->setEditable(false); // Profile fonts arern't loaded yet.. Using generic font. item->setFont(QFont("Sans Serif",18,QFont::Bold,false)); model->appendRow(item); i++; } ui->listView->setModel(model); ui->listView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->listView->setSelectionMode(QAbstractItemView::SingleSelection); if (sel>=0) ui->listView->setCurrentIndex(model->item(sel)->index()); m_tries=0; /*PREF["SkipLogin"]=false; if ((i==1) && PREF["SkipLogin"].toBool()) { if (!Profiles::profiles.contains(name)) PREF[STR_GEN_Profile]=name; QTimer::singleShot(0,this,SLOT(earlyExit())); hide(); } */ popupMenu=new QMenu(this); popupMenu->addAction(tr("Open Profile"),this,SLOT(openProfile())); popupMenu->addAction(tr("Edit Profile"),this,SLOT(editProfile())); popupMenu->addSeparator(); popupMenu->addAction(tr("Delete Profile"),this,SLOT(deleteProfile())); ui->labelAppName->setText(STR_TR_SleepyHead); ui->labelVersion->setText("v"+VersionString+" "+ReleaseStatus); // if (GIT_BRANCH!="master") // ui->labelBuild->setText(GIT_BRANCH); // else ui->labelBuild->setText(QString()); ui->labelFolder->setText(GetAppRoot()); ui->labelFolder->setToolTip("Current SleepyHead data folder\n"+GetAppRoot()); }
void VLCProfileSelector::editProfile() { editProfile( profileBox->currentText(), profileBox->itemData( profileBox->currentIndex() ).toString() ); }
void VLCProfileSelector::newProfile() { editProfile( "", "" ); }
/*Function: void EditStuProfileControl::updateProfile * Purpose: if editing, update profile settings in db * if creating, add new profile to db */ void EditStuProfileControl::updateProfile() { if(_action == 1) editProfile(); else createProfile(); }