⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addplaceholderpopup.cpp

📁 LINUX 下, 以 QT/KDE 写的档案管理员
💻 CPP
📖 第 1 页 / 共 2 页
字号:
}QString ParameterYes::text() {   if ( _checkBox->isChecked() )      return QString::null;   else      return "No";} QString ParameterYes::preset() {   return QString::null;} void ParameterYes::reset() {   _checkBox->setChecked( true );} bool ParameterYes::valid() {   return true;} ///////////// ParameterNoParameterNo::ParameterNo( const exp_parameter& parameter, QWidget* parent ) : ParameterBase( parameter, parent ) {   QVBoxLayout* layout = new QVBoxLayout( this );   layout->setAutoAdd( true );   layout->setSpacing( 6 );      _checkBox = new QCheckBox( i18n( parameter.description().utf8() ), this );   _checkBox->setChecked( false );}QString ParameterNo::text() {   if ( _checkBox->isChecked() )      return "Yes";   else      return QString::null;} QString ParameterNo::preset() {   return QString::null;} void ParameterNo::reset() {   _checkBox->setChecked( false );} bool ParameterNo::valid() {   return true;} ///////////// ParameterFileParameterFile::ParameterFile( const exp_parameter& parameter, QWidget* parent ) : ParameterBase( parameter, parent ) {   QVBoxLayout* layout = new QVBoxLayout( this );   layout->setAutoAdd( true );   layout->setSpacing( 6 );      new QLabel( i18n( parameter.description().utf8() ), this );   QHBox * hbox = new QHBox( this );   hbox->setSpacing( 6 );   _lineEdit = new KLineEdit( hbox );   _button = new QToolButton( hbox);   KIconLoader *iconLoader = new KIconLoader();  _button->setPixmap( iconLoader->loadIcon( "fileopen", KIcon::Toolbar, 16 ) );   connect( _button, SIGNAL(clicked()), this, SLOT(addFile()) );}QString ParameterFile::text() {   return _lineEdit->text();}QString ParameterFile::preset() {   return QString::null;} void ParameterFile::reset() {   _lineEdit->setText( QString::null );} bool ParameterFile::valid() {   if ( _lineEdit->text().isEmpty() )      return false;   else      return true;} void ParameterFile::addFile() {   QString filename = KFileDialog::getOpenFileName(QString::null, QString::null, this);   _lineEdit->insert( filename );}///////////// ParameterChooseParameterChoose::ParameterChoose( const exp_parameter& parameter, QWidget* parent ) : ParameterBase( parameter, parent ) {   QVBoxLayout* layout = new QVBoxLayout( this );   layout->setAutoAdd( true );   layout->setSpacing( 6 );      new QLabel( i18n( parameter.description().utf8() ), this );   _combobox = new KComboBox( this );   _combobox->insertStringList( QStringList::split( ";", parameter.preset().section(":", 1) ) );}QString ParameterChoose::text() {   return _combobox->currentText();} QString ParameterChoose::preset() {   return _combobox->text( 0 );} void ParameterChoose::reset() {   _combobox->setCurrentItem( 0 );} bool ParameterChoose::valid() {      return true;} ///////////// ParameterSelectParameterSelect::ParameterSelect( const exp_parameter& parameter, QWidget* parent ) : ParameterBase( parameter, parent ) {   QVBoxLayout* layout = new QVBoxLayout( this );   layout->setAutoAdd( true );   layout->setSpacing( 6 );      new QLabel( i18n( parameter.description().utf8() ), this );   _combobox = new KComboBox( this );   _combobox->setEditable( true );      krConfig->setGroup( "Private" );   QStrList lst;   int i = krConfig->readListEntry( "Predefined Selections", lst );   if ( i > 0 )      _combobox->insertStrList( lst );   _combobox->setCurrentText( "*" );}QString ParameterSelect::text() {   return _combobox->currentText();} QString ParameterSelect::preset() {   return "*";} void ParameterSelect::reset() {   _combobox->setCurrentText( "*" );} bool ParameterSelect::valid() {      return true;} ///////////// ParameterGotoParameterGoto::ParameterGoto( const exp_parameter& parameter, QWidget* parent ) : ParameterBase( parameter, parent ) {   QVBoxLayout* layout = new QVBoxLayout( this );   layout->setAutoAdd( true );   layout->setSpacing( 6 );      new QLabel( i18n( parameter.description().utf8() ), this );   QHBox * hbox = new QHBox( this );   hbox->setSpacing( 6 );   _lineEdit = new KLineEdit( hbox );   _lineEdit->setCompletionObject( new KURLCompletion( KURLCompletion::DirCompletion ) );   _dirButton = new QToolButton( hbox );   KIconLoader *iconLoader = new KIconLoader();  _dirButton->setPixmap( iconLoader->loadIcon( "fileopen", KIcon::Toolbar, 16 ) );   connect( _dirButton, SIGNAL(clicked()), this, SLOT(setDir()) );   _placeholderButton = new QToolButton( hbox);   _placeholderButton->setText( i18n("add") );   connect( _placeholderButton, SIGNAL(clicked()), this, SLOT(addPlaceholder()) );}QString ParameterGoto::text() {   return _lineEdit->text();}QString ParameterGoto::preset() {   return QString::null;} void ParameterGoto::reset() {   _lineEdit->setText( QString::null );} bool ParameterGoto::valid() {   if ( _lineEdit->text().isEmpty() )      return false;   else      return true;} void ParameterGoto::setDir() {   QString folder = KFileDialog::getExistingDirectory(QString::null, this);   _lineEdit->setText( folder );}void ParameterGoto::addPlaceholder() {   AddPlaceholderPopup* popup = new AddPlaceholderPopup( this );   QString exp = popup->getPlaceholder( mapToGlobal( QPoint( _placeholderButton->pos().x() + _placeholderButton->width() + 6, _placeholderButton->pos().y() + _placeholderButton->height() / 2 ) ) );   _lineEdit->insert( exp );   delete popup;}///////////// ParameterSyncprofileParameterSyncprofile::ParameterSyncprofile( const exp_parameter& parameter, QWidget* parent ) : ParameterBase( parameter, parent ) {   QVBoxLayout* layout = new QVBoxLayout( this );   layout->setAutoAdd( true );   layout->setSpacing( 6 );      new QLabel( i18n( parameter.description().utf8() ), this );   _combobox = new KComboBox( this );      _combobox->insertStringList( ProfileManager::availableProfiles("SynchronizerProfile") );}QString ParameterSyncprofile::text() {   return _combobox->currentText();} QString ParameterSyncprofile::preset() {   return _combobox->text( 0 );} void ParameterSyncprofile::reset() {   _combobox->setCurrentItem( 0 );} bool ParameterSyncprofile::valid() {      return true;} ///////////// ParameterSearchParameterSearch::ParameterSearch( const exp_parameter& parameter, QWidget* parent ) : ParameterBase( parameter, parent ) {   QVBoxLayout* layout = new QVBoxLayout( this );   layout->setAutoAdd( true );   layout->setSpacing( 6 );      new QLabel( i18n( parameter.description().utf8() ), this );   _combobox = new KComboBox( this );      _combobox->insertStringList( ProfileManager::availableProfiles("SearcherProfile") );}QString ParameterSearch::text() {   return _combobox->currentText();} QString ParameterSearch::preset() {   return _combobox->text( 0 );} void ParameterSearch::reset() {   _combobox->setCurrentItem( 0 );} bool ParameterSearch::valid() {      return true;} ///////////// ParameterPanelprofileParameterPanelprofile::ParameterPanelprofile( const exp_parameter& parameter, QWidget* parent ) : ParameterBase( parameter, parent ) {   QVBoxLayout* layout = new QVBoxLayout( this );   layout->setAutoAdd( true );   layout->setSpacing( 6 );      new QLabel( i18n( parameter.description().utf8() ), this );   _combobox = new KComboBox( this );      _combobox->insertStringList( ProfileManager::availableProfiles("Panel") );}QString ParameterPanelprofile::text() {   return _combobox->currentText();} QString ParameterPanelprofile::preset() {   return _combobox->text( 0 );} void ParameterPanelprofile::reset() {   _combobox->setCurrentItem( 0 );} bool ParameterPanelprofile::valid() {      return true;} ///////////// ParameterIntParameterInt::ParameterInt( const exp_parameter& parameter, QWidget* parent ) : ParameterBase( parameter, parent ) {   QHBoxLayout* layout = new QHBoxLayout( this );   layout->setAutoAdd( true );   layout->setSpacing( 6 );      new QLabel( i18n( parameter.description().utf8() ), this );   _spinbox = new KIntSpinBox( this );   QStringList para = QStringList::split( ";", parameter.preset().section(":", 1) );      _spinbox->setMinValue( para[0].toInt() );   _spinbox->setMaxValue( para[1].toInt() );   _spinbox->setLineStep( para[2].toInt() );   _spinbox->setValue( para[3].toInt() );      _default = _spinbox->value();}QString ParameterInt::text() {   return _spinbox->text();} QString ParameterInt::preset() {   return QString( "%1" ).arg( _default );} void ParameterInt::reset() {   return _spinbox->setValue( _default );} bool ParameterInt::valid() {      return true;} #include "addplaceholderpopup.moc"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -