예제 #1
0
SettingsDialog::SettingsDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SettingsDialog)
{
    ui->setupUi(this);
    connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(browseDir()));
}
예제 #2
0
NSettingsDownload::NSettingsDownload(QWidget *parent/*=NULL*/)
  : NSettingsWidget(parent),
    fnfmtCombo(NULL),
    fnfmtEdit(NULL),
    regexpCombo(NULL),
    regexpEdit(NULL),
    exampleEdit(NULL),
    savedirEdit(NULL)
{

// Save as

  QGroupBox *fngBox = new QGroupBox(tr("Save downloaded media as"));

  QGridLayout *g = new QGridLayout;

  addGridRow(g, tr("&Filename format:"),
             &fnfmtCombo, &fnfmtEdit, SLOT(fnfmtChanged(int)));

  addGridRow(g, tr("&Regular expression:"),
             &regexpCombo, &regexpEdit, SLOT(regexpChanged(int)));

  addGridRow(g, tr("Example:"), NULL, &exampleEdit, NULL);

  fngBox->setLayout(g);

  fnfmtCombo->addItem(tr("Default"), "%t.%s");
  fnfmtCombo->addItem(tr("With media ID"), "%t_%i.%s");
  fnfmtCombo->addItem(tr("With ID, domain"), "%t_%i_%d.%s");

  regexpCombo->addItem(tr("Default"), "/(\\w|\\s)/g");
  regexpCombo->addItem(tr("Word characters"), "/(\\w)/g");
  regexpCombo->addItem(tr("Digit characters"), "/(\\d)/g");

  exampleEdit->setReadOnly(true);

// Save in

  savedirEdit = new NTripwireEdit;
  savedirEdit->setReadOnly(true);

  connect(savedirEdit, SIGNAL(entered()), this, SLOT(browseDir()));

  QHBoxLayout *dirBox = new QHBoxLayout;
  dirBox->addWidget(savedirEdit);
  dirBox->addStretch(0);

  QGroupBox *dirgBox = new QGroupBox(tr("&Save downloaded media in"));
  dirgBox->setLayout(dirBox);

// Layout

  QVBoxLayout *box = new QVBoxLayout;
  box->addWidget(fngBox);
  box->addWidget(dirgBox);
  box->addStretch(0);
  setLayout(box);
}
예제 #3
0
void FileDialog::on_actionBack_triggered() {
	if (m_browsHistory.size() <= 0) {
		return;
	}

	QString fullpath = m_browsHistory.last();
	m_browsHistory.pop_back();

	if (m_browsHistory.size() == 0)
		ui.actionBack->setDisabled(true);

	browseDir(fullpath, false);
}
예제 #4
0
void FileDialog::on_treeWidget_itemDoubleClicked(QTreeWidgetItem* item, int column ) {
	FileItem* f_item = dynamic_cast<FileItem*>(item);

	if (!f_item)
		return;

	if (f_item->isDirectory()) {
		QString fullpath = m_curDir + item->text(0) + "/";

		browseDir(fullpath, true);
	} else {
		on_okButton_clicked();
	}
}
예제 #5
0
void FileDialog::on_actionParentDir_triggered() {
	QString par_path = m_curDir;

	// eat ending '/'
	size_t s = par_path.size();
	if (par_path[s - 1] == '/') {
		par_path.resize(s - 1);
		s--;
	}

	for (s--; s >= 0; s--) {
		if (par_path[s] == '/') {
			par_path.resize(s + 1);
			break;
		}
	}

	browseDir(par_path, true);
}
예제 #6
0
void FileDialog::setRootDir(const QString& dir) {
	m_rootDir = dir;

	if (!PathUtil::isDirectoryLetter(m_rootDir[m_rootDir.length()-1].toAscii()))
		m_rootDir += '/';

	m_rootInfos = g_fileSystem->getFileInfos(q2u(m_rootDir), "", File::List_sort);

	// add folder first
	size_t i;
	QString tmp;

	ui.rootDirTree->clear();
	for (i = 0; i < m_rootInfos.size(); i++) {
		if (!m_rootInfos[i]. isDir)
			continue;

		FileItem* item = new FileItem(ui.rootDirTree, m_rootInfos[i]);
	}

	browseDir(m_rootDir, false);
}
예제 #7
0
파일: Wizard.cpp 프로젝트: lazyrun/pokerbot
//  FolderPage
FolderPage::FolderPage(QWidget * parent)
: QWizardPage(parent)
{
   setTitle(tr("Alias Selection"));
   QGridLayout *grLayout = new QGridLayout();

   QLabel * lblAlias = new QLabel(tr("You should specify an alias for Maverick Poker Bot in this step. Memorize the selected alias, you will need it while using Maverick Poker Bot. You can specify the alias yourself or you can use the \"Random\" button for the installation wizard to offer you some random value."), this);
   lblAlias->setWordWrap(true);

   edtAlias_ = new QLineEdit(this);
   edtAlias_->setValidator(new QRegExpValidator(QRegExp("[a-zA-Z0-9 ]+"), this));
   edtAlias_->setAlignment(Qt::AlignCenter);
   QFont fn = edtAlias_->font();
   fn.setBold(true);
   fn.setPointSize(24);
   edtAlias_->setFont(fn);
   edtAlias_->setMaxLength(120);
   connect(edtAlias_, SIGNAL(textChanged(const QString &)), 
      this, SLOT(aliased(const QString &)));
   
   //QLabel * lbl = new QLabel(tr("Select the folder where you would like Holdem Folder to be installed, then click Next.<p>The program requires at least 10 MB of disk space."), this);
   //lbl->setWordWrap(true);

   QLabel * lblPath = new QLabel(tr("&Path to Maverick Poker Bot:"), this);
   
   lePath_ = new QLineEdit(this);
   lePath_->setText("C:\\Program Files\\");
   lePath_->setEnabled(false);
   lblPath->setBuddy(lePath_);
   folderPrefix_ = "C:\\Program Files\\";

   QToolButton * btnRandom = new QToolButton(this);
   btnRandom->setIcon(QIcon(":/images/dice.png")); 
   btnRandom->setText(tr("&Random")); 
   btnRandom->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
   QPushButton * btnBrowse = new QPushButton(tr("&Browse..."), this);
   //btnBrowse->setFixedSize(20, 20);
   connect(btnBrowse, SIGNAL(clicked()), this, SLOT(browseDir()));
   connect(btnRandom, SIGNAL(clicked()), this, SLOT(random()));
   btnRandom->setMinimumHeight(edtAlias_->sizeHint().height());
   btnRandom->setMinimumWidth(btnBrowse->sizeHint().width());
   btnRandom->setIconSize(QSize(32, 32));
   
   int row = 0;
   //grLayout->addWidget(lbl,    row++, 0, 1, 2);

   //grLayout->addItem(new QSpacerItem(1, 20,
   //   QSizePolicy::Fixed, QSizePolicy::Fixed), row++, 0, 1, 2);
   grLayout->addWidget(lblAlias,  row++, 0, 1, 1);
   grLayout->addWidget(edtAlias_,  row, 0, 1, 1);
   grLayout->addWidget(btnRandom, row++, 1, 1, 1, Qt::AlignCenter);

   grLayout->addItem(new QSpacerItem(1, 20,
      QSizePolicy::Fixed, QSizePolicy::Fixed), row++, 0, 1, 2);

   grLayout->addWidget(lblPath,   row++, 0, 1, 2);
   grLayout->addWidget(lePath_,    row,   0, 1, 1);
   grLayout->addWidget(btnBrowse, row++, 1, 1, 1, Qt::AlignRight);

   setLayout(grLayout);
}
예제 #8
0
InputStrList::InputStrList( QGridLayout *layout,int &row,
                            const QString & id, 
                            const QStringList &sl, ListMode lm,
                            const QString & docs)
  : m_default(sl), m_strList(sl), m_docs(docs), m_id(id)
{
  m_lab = new HelpLabel( id );

  m_le  = new QLineEdit;
  m_le->clear();

  QToolBar *toolBar = new QToolBar;
  toolBar->setIconSize(QSize(24,24));
  m_add = toolBar->addAction(QIcon(QString::fromAscii(":/images/add.png")),QString(),
                             this,SLOT(addString()));
  m_add->setToolTip(tr("Add item"));
  m_del = toolBar->addAction(QIcon(QString::fromAscii(":/images/del.png")),QString(),
                             this,SLOT(delString()));
  m_del->setToolTip(tr("Delete selected item"));
  m_upd = toolBar->addAction(QIcon(QString::fromAscii(":/images/refresh.png")),QString(),
                             this,SLOT(updateString()));
  m_upd->setToolTip(tr("Update selected item"));

  m_lb  = new QListWidget;
  //m_lb->setMinimumSize(400,100);
  foreach (QString s, m_strList) m_lb->addItem(s);
  
  m_brFile=0;
  m_brDir=0;
  if (lm!=ListString)
  {
    if (lm&ListFile)
    {
      m_brFile = toolBar->addAction(QIcon(QString::fromAscii(":/images/file.png")),QString(),
                                    this,SLOT(browseFiles()));
      m_brFile->setToolTip(tr("Browse to a file"));
    } 
    if (lm&ListDir)
    {
      m_brDir = toolBar->addAction(QIcon(QString::fromAscii(":/images/folder.png")),QString(),
                                   this,SLOT(browseDir()));
      m_brDir->setToolTip(tr("Browse to a folder"));
    }
  }
  QHBoxLayout *rowLayout = new QHBoxLayout;
  rowLayout->addWidget( m_le );
  rowLayout->addWidget( toolBar );
  layout->addWidget( m_lab,      row,0 );
  layout->addLayout( rowLayout,  row,1,1,2 );
  layout->addWidget( m_lb,       row+1,1,1,2 );
  row+=2;

  m_value = m_strList;

  connect(m_le,   SIGNAL(returnPressed()), 
          this, SLOT(addString()) );
  connect(m_lb,   SIGNAL(currentTextChanged(const QString &)), 
          this, SLOT(selectText(const QString &)));
  connect( m_lab, SIGNAL(enter()), SLOT(help()) );
  connect( m_lab, SIGNAL(reset()), SLOT(reset()) );
}
예제 #9
0
void FileDialog::on_filterComboBox_activated(int) {
	browseDir(m_curDir, false);
}
예제 #10
0
void FileDialog::on_dirComboBox_activated(int) {
	QString& txt = ui.dirComboBox->currentText();

	browseDir(txt, true);
}
예제 #11
0
void FileDialog::on_rootDirTree_itemDoubleClicked(QTreeWidgetItem* item, int column) {
	QString fullpath = m_rootDir + item->text(0) + "/";

	browseDir(fullpath, true);
}
InputStrList::InputStrList( const QString & label, 
                            QWidget *parent, QStrList &sl, ListMode lm)
  : QWidget(parent), strList(sl)
{
  QGridLayout *layout = new QGridLayout( this, 2, 2, 5 );
  lab = new QLabel( label, this );
  lab->setMinimumSize( lab->sizeHint() );
  layout->addWidget( lab,0,0 );

  QWidget *dw = new QWidget(this); /* dummy widget used for layouting */
  QHBoxLayout *boxlayout = new QHBoxLayout( dw, 0, 5 );
  le  = new QLineEdit( dw );
  le->setMinimumSize( le->sizeHint() );
  boxlayout->addWidget( le, 1 );

  add = new QPushButton( dw );
  //add->setPixmap( QPixmap( add_xpm ));
  add->setText( "+" );
  add->setMinimumSize( add->sizeHint() );
  QToolTip::add(add,"Add item");
  boxlayout->addWidget( add );

  del = new QPushButton( dw );
  //del->setPixmap( QPixmap( del_xpm ));
  del->setText( "-" );
  del->setMinimumSize( del->sizeHint() );
  QToolTip::add(del,"Delete selected item");
  boxlayout->addWidget( del );

  upd = new QPushButton( dw ); 
  //upd->setPixmap( QPixmap( update_xpm ));
  upd->setText( "*" );
  upd->setMinimumSize( upd->sizeHint() );
  QToolTip::add(upd,"Update selected item");
  boxlayout->addWidget( upd );

  lb  = new QListBox( this );
  lb->setMinimumSize(400,100);
  init();
  lb->setVScrollBarMode(QScrollView::Auto);
  lb->setHScrollBarMode(QScrollView::Auto);

  brFile=0;
  brDir=0;
  if (lm!=ListString)
  {
    if (lm&ListFile)
    {
      brFile = new QPushButton(dw);
      //brFile->setPixmap( QPixmap(file_xpm) );
      brFile->setText("Select...");
      brFile->setMinimumSize(brFile->sizeHint());
      QToolTip::add(brFile,"Browse to a file");
      boxlayout->addWidget( brFile );
    } 
    if (lm&ListDir)
    {
      brDir = new QPushButton(dw);
      //brDir->setPixmap( QPixmap(folder_xpm) );
      brDir->setText("Select...");
      brDir->setMinimumSize(brDir->sizeHint());
      QToolTip::add(brDir,"Browse to a folder");
      boxlayout->addWidget( brDir );
    }
  }
  layout->addWidget( dw, 0,1 );
  layout->addWidget( lb,1,1 );
  layout->activate();
  setMinimumSize( sizeHint() );

  connect(le,   SIGNAL(returnPressed()), 
          this, SLOT(addString()) );
  connect(add,  SIGNAL(clicked()), 
          this, SLOT(addString()) );
  connect(del,  SIGNAL(clicked()), 
          this, SLOT(delString()) );
  connect(upd,  SIGNAL(clicked()), 
          this, SLOT(updateString()) );
  if (brFile)
  {
    connect(brFile, SIGNAL(clicked()),
            this, SLOT(browseFiles()));
  }
  if (brDir)
  {
    connect(brDir, SIGNAL(clicked()),
            this, SLOT(browseDir()));
  }
  connect(lb,   SIGNAL(selected(const QString &)), 
          this, SLOT(selectText(const QString &)));
}