Example #1
2
/** The default constructor
  *
  * \param parent The parent widget
  *
  */
RainbruRPG::Gui::QuarantineList::QuarantineList(QWidget* parent) 
  :QWidget(parent){

  setWindowTitle(tr("Quarantine"));
  setMinimumSize(500, 150);

 // The main layout
  QVBoxLayout* vb1=new QVBoxLayout();
  this->setLayout(vb1);

  // The tool bar
  QToolBar* toolBar=new QToolBar(this);
  //  toolBar->setToolButtonStyle(Qt::ToolButtonTextOnly);

  previewAct=new QAction(QIcon(":/images/preview.png"),
			 tr("Preview"), toolBar);
  approveAct=new QAction(QIcon(":/images/accept.png"),
			 tr("Approve"), toolBar);
  deleteAct=new QAction(QIcon(":/images/refuse.png"),
			tr("Delete"), toolBar);
  QAction* refreshAct=new QAction(tr("Refresh"), toolBar);

  QAction* helpAct=new QAction(tr("Help"), toolBar);

  previewAct->setEnabled(false);
  approveAct->setEnabled(false);
  deleteAct->setEnabled(false);

  toolBar->addAction(previewAct);
  toolBar->addAction(approveAct);
  toolBar->addAction(deleteAct);
  toolBar->addSeparator();
  toolBar->addAction(refreshAct);
  toolBar->addSeparator();
  toolBar->addAction(helpAct);

  vb1->addWidget(toolBar);

  labStillInTransfer=new 
    QLabel("At least one file is still in transfer, it's size and its type "
	   "could be wrong. You can click the refresh button to update "
	   "informations and look at FTP server (Ctrl+F) to see if the "
	   "transfer is finished.");
  labStillInTransfer->setVisible(false);
  labStillInTransfer->setWordWrap(true);
  vb1->addWidget(labStillInTransfer);

  // The list widget
  tree=new QTreeWidget();
  tree->setSortingEnabled(true);
  tree->setSelectionMode(QAbstractItemView::ExtendedSelection);
  QStringList header;
  header << tr("Filename") << tr("Size") << tr("Usage") << tr("Type");
  tree->setColumnCount(4);
  tree->setHeaderLabels(header);
  vb1->addWidget(tree);

  refresh();


  connect(tree, SIGNAL(itemSelectionChanged()), this,
	  SLOT(treeSelectionChanged()));

  connect(tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
	  this, SLOT(treeDoubleClicked(QTreeWidgetItem*,int)));

  connect(previewAct, SIGNAL(triggered()), this, SLOT(filePreview()));
  connect(approveAct, SIGNAL(triggered()), this, SLOT(fileAccept()));
  connect(deleteAct,  SIGNAL(triggered()), this, SLOT(fileRefused()));
  connect(refreshAct, SIGNAL(triggered()), this, SLOT(refresh()));
  connect(helpAct,    SIGNAL(triggered()), this, SLOT(showHelp()));

}
Example #2
0
void QPhotorec::setupUI()
{
  QWidget *t_copy = copyright(this);
  QLabel *t_free_soft = new QLabel(tr("PhotoRec is free software, and comes with ABSOLUTELY NO WARRANTY."));
  QLabel *t_select = new QLabel(tr("Please select a media to recover from"));

  HDDlistWidget = new QComboBox();
  HDDlistWidget->setToolTip(tr("Disk capacity must be correctly detected for a successful recovery.\n"
      "If a disk listed above has an incorrect size, check HD jumper settings and BIOS\n"
      "detection, and install the latest OS patches and disk drivers.")
  );

  QStringList oLabel;
  oLabel.append("");
  oLabel.append(tr("Flags"));
  oLabel.append(tr("Type"));
  oLabel.append(tr("File System"));
  oLabel.append(tr("Size"));
  oLabel.append(tr("Label"));

  PartListWidget= new QTableWidget();
  PartListWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
  PartListWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
  PartListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
  PartListWidget->verticalHeader()->hide();
  PartListWidget->setShowGrid(false);
  PartListWidget->setColumnCount( 6 );
  PartListWidget->setHorizontalHeaderLabels( oLabel );
  PartListWidget_updateUI();

  QGroupBox *groupBox1;
  QGroupBox *groupBox2;

  groupBox1 = new QGroupBox(tr("File System type"));
  qextRadioButton = new QRadioButton(tr("ext2/ext3/ext4 filesystem"));
  qfatRadioButton = new QRadioButton(tr("FAT/NTFS/HFS+/ReiserFS/..."));
  qfatRadioButton->setChecked(true);

  groupBox2 = new QGroupBox();
  qfreeRadioButton = new QRadioButton(tr("Free: Scan for file from unallocated space only"));
  qwholeRadioButton = new QRadioButton(tr("Whole: Extract files from whole partition"));
  qfreeRadioButton->setEnabled(false);
  qwholeRadioButton->setChecked(true);


  QVBoxLayout *groupBox1Layout = new QVBoxLayout;
  QVBoxLayout *groupBox2Layout = new QVBoxLayout;

  groupBox1Layout->addWidget(qextRadioButton);
  groupBox1Layout->addWidget(qfatRadioButton);
  groupBox1->setLayout(groupBox1Layout);

  groupBox2Layout->addWidget(qfreeRadioButton);
  groupBox2Layout->addWidget(qwholeRadioButton);
  groupBox2->setLayout(groupBox2Layout);

  QWidget *groupBox= new QWidget();
  QHBoxLayout *groupBoxLayout = new QHBoxLayout;
  groupBoxLayout->addWidget(groupBox1);
  groupBoxLayout->addWidget(groupBox2);
  groupBox->setLayout(groupBoxLayout);


  QLabel *dstWidget= new QLabel(tr("Please select a destination to save the recovered files to."));
  directoryLabel=new QLineEdit("");
  QPushButton *dst_button = new QPushButton(
      QIcon::fromTheme("folder", QIcon(":res/gnome/folder.png")),
      tr("&Browse"));

  QWidget *dst_widget= new QWidget(this);
  QWidget *dst_widget2= new QWidget(this);

  QHBoxLayout *dst_widgetLayout2 = new QHBoxLayout;
  dst_widgetLayout2->addWidget(directoryLabel);
  dst_widgetLayout2->addWidget(dst_button);
  dst_widget2->setLayout(dst_widgetLayout2);

  QVBoxLayout *dst_widgetLayout = new QVBoxLayout;
  dst_widgetLayout->addWidget(dstWidget);
  dst_widgetLayout->addWidget(dst_widget2);
  dst_widget->setLayout(dst_widgetLayout);
  

  button_search = new QPushButton(QIcon::fromTheme("go-next", QIcon(":res/gnome/go-next.png")), "&Search");
  button_search->setEnabled(false);
  QPushButton *button_quit= new QPushButton(QIcon::fromTheme("application-exit", QIcon(":res/gnome/application-exit.png")), "&Quit");
  QPushButton *button_about= new QPushButton(QIcon::fromTheme("help-about", QIcon(":res/gnome/help-about.png")), "&About");
  QPushButton *button_formats= new QPushButton(QIcon::fromTheme("image-x-generic.png", QIcon(":res/gnome/image-x-generic.png")),tr("&File Formats"));

  QWidget *B_widget = new QWidget(this);
  QHBoxLayout *B_layout = new QHBoxLayout(B_widget);
  B_layout->addWidget(button_about);
  B_layout->addWidget(button_formats);
  B_layout->addWidget(button_search);
  B_layout->addWidget(button_quit);
  B_widget->setLayout(B_layout);

  clearWidgets();
//  QLayout *mainLayout = this->layout();
  delete this->layout();
  QVBoxLayout *mainLayout = new QVBoxLayout();
  mainLayout->addWidget(t_copy);
  mainLayout->addWidget(t_free_soft);
  mainLayout->addWidget(t_select);
  mainLayout->addWidget(HDDlistWidget);
  mainLayout->addWidget(PartListWidget);
  mainLayout->addWidget(groupBox);
  mainLayout->addWidget(dst_widget);
  mainLayout->addWidget(B_widget);
  this->setLayout(mainLayout);

  HDDlistWidget_updateUI();
  buttons_updateUI();

  connect(button_about, SIGNAL(clicked()), this, SLOT(qphotorec_about()) );
  connect(button_formats, SIGNAL(clicked()), this, SLOT(qphotorec_formats()) );
  connect(button_search, SIGNAL(clicked()), this, SLOT(qphotorec_search()) );
  connect(button_quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
  connect(HDDlistWidget, SIGNAL(activated(int)),this,SLOT(disk_changed(int)));
  connect(PartListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(partition_selected()));
  connect(dst_button, SIGNAL(clicked()), this, SLOT(setExistingDirectory()));
  connect(directoryLabel, SIGNAL(editingFinished()), this, SLOT(buttons_updateUI()));
}
Example #3
0
/**
 * Constructor
 */
FlarmAliasList::FlarmAliasList( QWidget *parent ) :
  QWidget( parent ),
  list(0),
  m_enableScroller(0)
{
  setAttribute( Qt::WA_DeleteOnClose );

  QHBoxLayout *topLayout = new QHBoxLayout( this );
  topLayout->setSpacing(5);

  list = new QTableWidget( 0, 2, this );
  list->setSelectionBehavior( QAbstractItemView::SelectRows );
  // list->setSelectionMode( QAbstractItemView::SingleSelection );
  list->setAlternatingRowColors( true );
  list->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
  list->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );

#ifdef ANDROID
  QScrollBar* lvsb = list->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  QScroller::grabGesture( list->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( list->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  QString style = "QTableView QTableCornerButton::section { background: gray }";
  list->setStyleSheet( style );
  QHeaderView *vHeader = list->verticalHeader();
  style = "QHeaderView::section { width: 2em }";
  vHeader->setStyleSheet( style );

  // set new row height from configuration
  int afMargin = GeneralConfig::instance()->getListDisplayAFMargin();
  rowDelegate = new RowDelegate( list, afMargin );
  list->setItemDelegate( rowDelegate );

  // hide vertical headers
  // QHeaderView *vHeader = list->verticalHeader();
  // vHeader->setVisible(false);

  QHeaderView* hHeader = list->horizontalHeader();
  hHeader->setStretchLastSection( true );
#if QT_VERSION >= 0x050000
  hHeader->setSectionsClickable( true );
#else
  hHeader->setClickable( true );
#endif

  connect( hHeader, SIGNAL(sectionClicked(int)),
           this, SLOT(slot_HeaderClicked(int)) );

  QTableWidgetItem *item = new QTableWidgetItem( tr(" Flarm ID ") );
  list->setHorizontalHeaderItem( 0, item );

  item = new QTableWidgetItem( tr(" Alias (15) ") );
  list->setHorizontalHeaderItem( 1, item );

  connect( list, SIGNAL(cellChanged( int, int )),
           this, SLOT(slot_CellChanged( int, int )) );

  connect( list, SIGNAL(cellClicked( int, int )),
           this, SLOT(slot_CellClicked( int, int )) );

  connect( list, SIGNAL(itemSelectionChanged()),
           this, SLOT(slot_ItemSelectionChanged()) );

  topLayout->addWidget( list, 2 );

  QGroupBox* buttonBox = new QGroupBox( this );

  int buttonSize = Layout::getButtonSize();
  int iconSize   = buttonSize - 5;

  QPushButton *addButton  = new QPushButton;
  addButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "add.png" ) ) );
  addButton->setIconSize(QSize(iconSize, iconSize));
  // addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  addButton->setMinimumSize(buttonSize, buttonSize);
  addButton->setMaximumSize(buttonSize, buttonSize);

  deleteButton  = new QPushButton;
  deleteButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "delete.png" ) ) );
  deleteButton->setIconSize(QSize(iconSize, iconSize));
  // deleteButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  deleteButton->setMinimumSize(buttonSize, buttonSize);
  deleteButton->setMaximumSize(buttonSize, buttonSize);
  deleteButton->setEnabled(false);

#if defined(QSCROLLER) || defined(QTSCROLLER)

  m_enableScroller = new QCheckBox("][");
  m_enableScroller->setCheckState( Qt::Checked );
  m_enableScroller->setMinimumHeight( Layout::getButtonSize(12) );

  connect( m_enableScroller, SIGNAL(stateChanged(int)),
	   this, SLOT(slot_scrollerBoxToggled(int)) );

#endif

  QPushButton *okButton = new QPushButton;
  okButton->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  okButton->setIconSize(QSize(iconSize, iconSize));
  // okButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  okButton->setMinimumSize(buttonSize, buttonSize);
  okButton->setMaximumSize(buttonSize, buttonSize);

  QPushButton *closeButton = new QPushButton;
  closeButton->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  closeButton->setIconSize(QSize(iconSize, iconSize));
  // closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  closeButton->setMinimumSize(buttonSize, buttonSize);
  closeButton->setMaximumSize(buttonSize, buttonSize);

  connect( addButton, SIGNAL(clicked() ), this, SLOT(slot_AddRow()) );
  connect( deleteButton, SIGNAL(clicked() ), this, SLOT(slot_DeleteRows()) );
  connect( okButton, SIGNAL(clicked() ), this, SLOT(slot_Ok()) );
  connect( closeButton, SIGNAL(clicked() ), this, SLOT(slot_Close()) );

  // vertical box with operator buttons
  QVBoxLayout *vbox = new QVBoxLayout;

  vbox->setSpacing(0);
  vbox->addWidget( addButton );
  vbox->addSpacing(32);
  vbox->addWidget( deleteButton );
  vbox->addStretch(2);

#if defined(QSCROLLER) || defined(QTSCROLLER)

  vbox->addWidget( m_enableScroller, 0, Qt::AlignCenter );
  vbox->addStretch(2);

#endif

  vbox->addWidget( okButton );
  vbox->addSpacing(32);
  vbox->addWidget( closeButton );
  buttonBox->setLayout( vbox );

  topLayout->addWidget( buttonBox );

  // load alias data into table
  if( ! aliasHash.isEmpty() )
    {
      QMutableHashIterator<QString, QString> it(aliasHash);

      while( it.hasNext() )
        {
          it.next();
          slot_AddRow( it.key(), it.value() );
        }

      list->sortByColumn( 1, Qt::AscendingOrder );
    }
}
RegisteredUserEntryDialog::RegisteredUserEntryDialog(QWidget *p,KviRegisteredUser * r,bool bModal)
: KviTalTabDialog(p,"reguser_entry_editor",bModal)
{
	m_pUser = r;
	m_pCustomColor = new QColor();

	if(r)
	{
		QString col=r->getProperty("customColor");
		KviStringConversion::fromString(col,(*m_pCustomColor));
	}

	m_pPropertyDict = new KviPointerHashTable<QString,QString>(17,false);
	m_pPropertyDict->setAutoDelete(true);

	//setMinimumSize(400,450);

	setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Linux)));
	setWindowTitle(__tr2qs_ctx("Registered User Entry","register"));

	QWidget * p1 = new QWidget(this);

	QGridLayout * g = new QGridLayout(p1);

	QLabel * l = new QLabel(__tr2qs_ctx("Name:","register"),p1);
	g->addWidget(l,0,0);

	m_pNameEdit = new QLineEdit(p1);
	g->addWidget(m_pNameEdit,0,1);

	l = new QLabel(__tr2qs_ctx("Comment:","register"),p1);
	g->addWidget(l,1,0);

	m_pCommentEdit = new QLineEdit(p1);
	g->addWidget(m_pCommentEdit,1,1);

	QFrame * f = new QFrame(p1);
	g->addWidget(f,2,0,1,2);
	f->setFrameStyle(QFrame::HLine | QFrame::Sunken);

	l = new QLabel(__tr2qs_ctx("Masks:","register"),p1);
	g->addWidget(l,3,0,1,2);

	m_pMaskListBox = new QListWidget(p1);
	connect(m_pMaskListBox,SIGNAL(itemSelectionChanged()),this,SLOT(maskCurrentChanged()));
	m_pMaskListBox->setMinimumSize(300,200);

	g->addWidget(m_pMaskListBox,4,0,1,2);

	KviTalHBox * b = new KviTalHBox(p1);
	g->addWidget(b,5,0,1,2);
	b->setSpacing(4);

	m_pAddMaskButton = new QPushButton(__tr2qs_ctx("&Add...","register"),b);
	connect(m_pAddMaskButton,SIGNAL(clicked()),this,SLOT(addMaskClicked()));
	m_pAddMaskButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::NewItem)));

	m_pDelMaskButton = new QPushButton(__tr2qs_ctx("Re&move","register"),b);
	m_pDelMaskButton->setEnabled(false);
	connect(m_pDelMaskButton,SIGNAL(clicked()),this,SLOT(delMaskClicked()));
	m_pDelMaskButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::DeleteItem)));

	m_pEditMaskButton = new QPushButton(__tr2qs_ctx("&Edit","register"),b);
	m_pEditMaskButton->setEnabled(false);
	connect(m_pEditMaskButton,SIGNAL(clicked()),this,SLOT(editMaskClicked()));
	m_pEditMaskButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::EditItem)));

	g->setRowStretch(4,1);
	g->setColumnStretch(1,1);

	addTab(p1,__tr2qs_ctx("Identity","register"));

	QWidget * p2 = new QWidget(this);

	g = new QGridLayout(p2);

	m_pNotifyCheck = new QCheckBox(__tr2qs_ctx("Notify when user is online","register"),p2);
	g->addWidget(m_pNotifyCheck,0,0,1,3);

	m_pNotifyLabel = new QLabel(__tr2qs_ctx("Notify nicknames:","register"),p2);
	m_pNotifyLabel->setEnabled(m_pNotifyCheck->isChecked());
	g->addWidget(m_pNotifyLabel,1,0);
	m_pNotifyCheck->setToolTip(__tr2qs_ctx("<center>You can enter a space separated list of nicknames.</center>","register"));


	m_pNotifyNick = new QLineEdit(p2);
	m_pNotifyNick->setEnabled(false);

	g->addWidget(m_pNotifyNick,1,1,1,2);
	connect(m_pNotifyCheck,SIGNAL(toggled(bool)),this,SLOT(notifyCheckClicked(bool)));


	f = new QFrame(p2);
	f->setFrameStyle(QFrame::HLine | QFrame::Sunken);
	g->addWidget(f,2,0,1,3);

	f = new QFrame(p2);
	f->setFrameStyle(QFrame::HLine | QFrame::Sunken);
	g->addWidget(f,4,0,1,3);

	m_pCustomColorCheck = new QCheckBox(__tr2qs_ctx("Use custom color in userlist","register"),p2);
	if(r)
		m_pCustomColorCheck->setChecked(r->getBoolProperty("useCustomColor"));
	g->addWidget(m_pCustomColorCheck,5,0,1,2);

	m_pCustomColorSelector = new KviColorSelector(p2,QString(),m_pCustomColor,1);
	g->addWidget(m_pCustomColorSelector,5,2);

	QPushButton * pb = new QPushButton(__tr2qs_ctx("All Properties...","register"),p2);
	connect(pb,SIGNAL(clicked()),this,SLOT(editAllPropertiesClicked()));
	g->addWidget(pb,6,2);

	g->setColumnStretch(1,1);
	g->setRowStretch(3,1);

	addTab(p2,__tr2qs_ctx("Properties","register"));

	// Ignore TAB
	KviTalVBox * vb = new KviTalVBox(this);
	vb->setMargin(10);

	m_pIgnoreEnabled = new QCheckBox(__tr2qs_ctx("Enable ignore for this user","register"),vb);

	QGroupBox * gb = new QGroupBox(__tr2qs_ctx("Ignore features","register"),vb);
	connect(m_pIgnoreEnabled,SIGNAL(toggled(bool)),gb,SLOT(setEnabled(bool)));

	QVBoxLayout * layout = new QVBoxLayout(gb);
	layout->setMargin(20);
	layout->setSpacing(3);

	m_pIgnoreQuery = new QCheckBox(__tr2qs_ctx("Ignore query messages","register"),gb);
	layout->addWidget(m_pIgnoreQuery);

	m_pIgnoreChannel = new QCheckBox(__tr2qs_ctx("Ignore channel messages","register"),gb);
	layout->addWidget(m_pIgnoreChannel);

	m_pIgnoreNotice = new QCheckBox(__tr2qs_ctx("Ignore notice messages","register"),gb);
	layout->addWidget(m_pIgnoreNotice);

	m_pIgnoreCtcp = new QCheckBox(__tr2qs_ctx("Ignore CTCP messages","register"),gb);
	layout->addWidget(m_pIgnoreCtcp);

	m_pIgnoreInvite = new QCheckBox(__tr2qs_ctx("Ignore invites","register"),gb);
	layout->addWidget(m_pIgnoreInvite);

	m_pIgnoreDcc = new QCheckBox(__tr2qs_ctx("Ignore DCCs","register"),gb);
	layout->addWidget(m_pIgnoreDcc);

	QWidget *w = new QWidget(vb);
	w->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored);

	addTab(vb,__tr2qs_ctx("Ignore","register"));

	setCancelButton(__tr2qs_ctx("Cancel","register"));
	setOkButton(__tr2qs_ctx("&OK","register"));
	connect(this,SIGNAL(applyButtonPressed()),this,SLOT(okClicked()));
	connect(this,SIGNAL(cancelButtonPressed()),this,SLOT(reject()));

	if(r)
	{
		m_pNameEdit->setText(r->name());
		m_pCommentEdit->setText(r->getProperty("comment"));
		for(KviIrcMask * m = r->maskList()->first();m;m = r->maskList()->next())
		{
			QString mk = m->nick();
			mk += QChar('!');
			mk += m->user();
			mk += QChar('@');
			mk += m->host();
			m_pMaskListBox->addItem(mk);
		}

		QString szNotifyNicks = r->getProperty("notify");
		if(!szNotifyNicks.isEmpty())
		{
			m_pNotifyCheck->setChecked(true);
			m_pNotifyNick->setText(szNotifyNicks);
			m_pNotifyNick->setEnabled(true);
		}

		if(r->propertyDict())
		{
			KviPointerHashTableIterator<QString,QString> it(*(r->propertyDict()));
			while(QString *s = it.current())
			{
				m_pPropertyDict->insert(it.currentKey(),new QString(*s));
				++it;
			}
		}

		m_pIgnoreEnabled->setChecked(r->ignoreEnagled());

		gb->setEnabled(r->ignoreEnagled());

		m_pIgnoreQuery->setChecked(r->ignoreFlags() & KviRegisteredUser::Query);
		m_pIgnoreChannel->setChecked(r->ignoreFlags() & KviRegisteredUser::Channel);
		m_pIgnoreNotice->setChecked(r->ignoreFlags() & KviRegisteredUser::Notice);
		m_pIgnoreCtcp->setChecked(r->ignoreFlags() & KviRegisteredUser::Ctcp);
		m_pIgnoreInvite->setChecked(r->ignoreFlags() & KviRegisteredUser::Invite);
		m_pIgnoreDcc->setChecked(r->ignoreFlags() & KviRegisteredUser::Dcc);
	} else {
		// default values
		if(!m_pIgnoreEnabled->isChecked())
		{
			gb->setEnabled(false);
		}
	}
}
QgsNewVectorLayerDialog::QgsNewVectorLayerDialog( QWidget *parent, const Qt::WindowFlags& fl )
    : QDialog( parent, fl )
{
  setupUi( this );

  QSettings settings;
  restoreGeometry( settings.value( "/Windows/NewVectorLayer/geometry" ).toByteArray() );

  mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionNewAttribute.png" ) );
  mRemoveAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteAttribute.png" ) );
  mTypeBox->addItem( tr( "Text data" ), "String" );
  mTypeBox->addItem( tr( "Whole number" ), "Integer" );
  mTypeBox->addItem( tr( "Decimal number" ), "Real" );
  mTypeBox->addItem( tr( "Date" ), "Date" );

  mWidth->setValidator( new QIntValidator( 1, 255, this ) );
  mPrecision->setValidator( new QIntValidator( 0, 15, this ) );

  mPointRadioButton->setChecked( true );
  mFileFormatComboBox->addItem( tr( "ESRI Shapefile" ), "ESRI Shapefile" );
#if 0
  // Disabled until provider properly supports editing the created file formats
  // When enabling this, adapt the window-title of the dialog and the title of all actions showing this dialog.
  mFileFormatComboBox->addItem( tr( "Comma Separated Value" ), "Comma Separated Value" );
  mFileFormatComboBox->addItem( tr( "GML" ), "GML" );
  mFileFormatComboBox->addItem( tr( "Mapinfo File" ), "Mapinfo File" );
#endif
  if ( mFileFormatComboBox->count() == 1 )
  {
    mFileFormatComboBox->setVisible( false );
    mFileFormatLabel->setVisible( false );
  }

  mFileFormatComboBox->setCurrentIndex( 0 );

  mFileEncoding->addItems( QgsVectorDataProvider::availableEncodings() );

  // Use default encoding if none supplied
  QString enc = QSettings().value( "/UI/encoding", "System" ).toString();

  // The specified decoding is added if not existing alread, and then set current.
  // This should select it.
  int encindex = mFileEncoding->findText( enc );
  if ( encindex < 0 )
  {
    mFileEncoding->insertItem( 0, enc );
    encindex = 0;
  }
  mFileEncoding->setCurrentIndex( encindex );

  mOkButton = buttonBox->button( QDialogButtonBox::Ok );

  mAttributeView->addTopLevelItem( new QTreeWidgetItem( QStringList() << "id" << "Integer" << "10" << "" ) );

  QgsCoordinateReferenceSystem defaultCrs;
  defaultCrs.createFromOgcWmsCrs( settings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString() );
  defaultCrs.validate();
  mCrsSelector->setCrs( defaultCrs );

  connect( mNameEdit, SIGNAL( textChanged( QString ) ), this, SLOT( nameChanged( QString ) ) );
  connect( mAttributeView, SIGNAL( itemSelectionChanged() ), this, SLOT( selectionChanged() ) );

  mAddAttributeButton->setEnabled( false );
  mRemoveAttributeButton->setEnabled( false );
}
void CCCITT4Client::UpdateFileList()
{
    QListWidgetItem *pListItem;
    QDir *pDir;
    QFileInfoList list;
    int i, j;
    bool bFileExists, bItemExists;

    /* Disconnect the list event while changing the contents */
    disconnect(ui->listWidgetFiles, SIGNAL(itemSelectionChanged()), this, SLOT(OnFilesListSelectionChanged()));

    /* Obtain a list of all the tif files in the selected directory */
    pDir = new QDir(ui->lineEditPath->text());
    list = pDir->entryInfoList(QStringList("*.tif"), QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks, QDir::Time);

    /* Remove list elements of which the corresponding file does not exist anymore */
    for(i = 0; i < ui->listWidgetFiles->count(); i++)
    {
        pListItem = ui->listWidgetFiles->item(i);

        /* Verify if the file exists */
        bFileExists = false;
        if(pListItem != NULL)
        {
            for(j = 0; (j < list.size()) && (bFileExists == false); j++)
            {
                if(list.at(j).fileName().compare(pListItem->text()) == 0)
                {
                    bFileExists = true;
                }
            }
        }

        /* Delete the list element if the file doesn't exists */
        if(bFileExists == false)
        {
            ui->listWidgetFiles->removeItemWidget(pListItem);
            delete pListItem;
            pListItem = NULL;
            i = 0;
        }
    }

    /* Iterate over all the files and add them to the list if they are not contained yet */
    for(i = 0; i < list.size(); ++i)
    {
        bItemExists = false;
        for(j = 0; j < ui->listWidgetFiles->count(); j++)
        {
            if(list.at(i).fileName().compare(ui->listWidgetFiles->item(j)->text()) == 0)
            {
                bItemExists = true;
            }
        }

        if(bItemExists == false)
        {
            pListItem = new QListWidgetItem(QIcon(list.at(i).absoluteFilePath()), list.at(i).fileName());

            ui->listWidgetFiles->addItem(pListItem);
        }
    }

    /* Alternate the backgroundcolor of the list elements */
    for(i = 0; i < ui->listWidgetFiles->count(); i++)
    {
        if(i & 0x1)
        {
            ui->listWidgetFiles->item(i)->setBackgroundColor(QColor::fromHsv(0,0,240));
        }
        else
        {
            ui->listWidgetFiles->item(i)->setBackgroundColor(QColor::fromHsv(0,0,255));
        }
    }

    delete pDir;

    /* reconnnect the list event */
    connect(ui->listWidgetFiles, SIGNAL(itemSelectionChanged()), this, SLOT(OnFilesListSelectionChanged()));
}
Example #7
0
CServicesWidget::CServicesWidget(QWidget *parent)
:QWidget(parent)
{
	g_Services = this;

	m_Mode = eUnknown;
	m_pHostersSyncJob = NULL;

	m_pMainLayout = new QVBoxLayout();
	m_pMainLayout->setMargin(1);

	m_pFilterWidget = new QWidget();
	m_pFilterLayout = new QGridLayout();
	m_pFilterLayout->setMargin(3);
	m_pFilterLayout->setAlignment(Qt::AlignLeft);

	m_pHostFilter = new QLineEdit();
	m_pHostFilter->setMaximumWidth(200);
	m_pFilterLayout->addWidget(m_pHostFilter, 0, 0);

	m_pAccountsOnly = new QCheckBox(tr("Only with Accounts"));
	m_pFilterLayout->addWidget(m_pAccountsOnly, 0, 1);

	m_pFilterWidget->setLayout(m_pFilterLayout);
	m_pFilterWidget->setMaximumWidth(300);

	m_pMainLayout->addWidget(m_pFilterWidget);

	m_pSplitter = new QSplitter();
	m_pSplitter->setOrientation(Qt::Vertical);

	m_pHostsWidget = new QWidget();
	m_pHostsLayout = new QVBoxLayout();
	m_pHostsLayout->setMargin(0);

	m_pHosterTree = new QTreeWidget();
	m_pHosterTree->setHeaderLabels(tr("HostName|Status|APIs").split("|"));
	m_pHosterTree->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(m_pHosterTree, SIGNAL(customContextMenuRequested( const QPoint& )), this, SLOT(OnMenuRequested(const QPoint &)));
	//connect(m_pHosterTree, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(OnItemClicked(QTreeWidgetItem*, int)));
	connect(m_pHosterTree, SIGNAL(itemSelectionChanged()), this, SLOT(OnSelectionChanged()));
	m_pHosterTree->setSortingEnabled(true);

	m_pMenu = new QMenu();

	m_pAddAccount = new QAction(tr("Add Account"), m_pMenu);
	connect(m_pAddAccount, SIGNAL(triggered()), this, SLOT(OnAddAccount()));
	m_pMenu->addAction(m_pAddAccount);

	m_pRemoveAccount = new QAction(tr("Remove Account"), m_pMenu);
	connect(m_pRemoveAccount, SIGNAL(triggered()), this, SLOT(OnRemoveAccount()));
	m_pMenu->addAction(m_pRemoveAccount);

	m_pCheckAccount = new QAction(tr("Check Account"), m_pMenu);
	connect(m_pCheckAccount, SIGNAL(triggered()), this, SLOT(OnCheckAccount()));
	m_pMenu->addAction(m_pCheckAccount);


	m_pHostsLayout->addWidget(m_pHosterTree);

	m_pHostsWidget->setLayout(m_pHostsLayout);
	m_pSplitter->addWidget(m_pHostsWidget);

	m_pHosterTabs = new QTabWidget();

	m_pHostWidget = new QWidget();
	m_pHostLayout = new QStackedLayout(m_pHostWidget);
	m_pHostLayout->addWidget(new QWidget()); // blank on top

	m_HosterView = new CHosterView();
	m_pHostLayout->addWidget(m_HosterView);

	m_AccountView = new CAccountView();
	m_pHostLayout->addWidget(m_AccountView);

	m_pHostWidget->setLayout(m_pHostLayout);
	m_pHosterTabs->addTab(m_pHostWidget, tr("Details"));

	if(theGUI->Cfg()->GetInt("Gui/AdvancedControls") == 1)
	{
		m_pProperties = new CPropertiesView(true);
		m_pHosterTabs->addTab(m_pProperties, tr("Properties"));
	}
	else
		m_pProperties = NULL;

	m_pSubWidget = new QWidget();
	m_pSubLayout = new QVBoxLayout();
	m_pSubLayout->setMargin(0);

	m_pSubLayout->addWidget(m_pHosterTabs);

	m_pSubWidget->setLayout(m_pSubLayout);

	m_pSplitter->addWidget(m_pSubWidget);

	m_pMainLayout->addWidget(m_pSplitter);

	setLayout(m_pMainLayout);

	m_pSplitter->restoreState(theGUI->Cfg()->GetBlob("Gui/Widget_Hosters_Spliter"));
	m_pHosterTree->header()->restoreState(theGUI->Cfg()->GetBlob("Gui/Widget_Hosters_Columns"));

	m_TimerId = startTimer(500);
}
Example #8
0
GPXLab::GPXLab(const QString &fileName, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::GPXLab),
    closing(false)
{
    // setup UI
    ui->setupUi(this);

    // create GPX_model wrapper
    gpxmw = new GPX_wrapper(appName);
    connect(gpxmw, SIGNAL(fileLoaded()), this, SLOT(fileLoaded()));
    connect(gpxmw, SIGNAL(fileSaved()), this, SLOT(fileSaved()));
    connect(gpxmw, SIGNAL(modelCleared()), this, SLOT(modelCleared()));
    connect(gpxmw, SIGNAL(modelPropertiesChanged()), this, SLOT(modelPropertiesChanged()));
    connect(gpxmw, SIGNAL(modelMetadataChanged()), this, SLOT(modelMetadataChanged()));
    connect(gpxmw, SIGNAL(trackMetadataChanged(int)), this, SLOT(trackMetadataChanged(int)));
    connect(gpxmw, SIGNAL(trackInserted(int, const GPX_trkType&)), this, SLOT(trackInserted(int, const GPX_trkType&)));
    connect(gpxmw, SIGNAL(trackDeleted(int)), this, SLOT(trackDeleted(int)));
    connect(gpxmw, SIGNAL(trackMovedUp(int)), this, SLOT(trackMovedUp(int)));
    connect(gpxmw, SIGNAL(trackMovedDown(int)), this, SLOT(trackMovedDown(int)));
    connect(gpxmw, SIGNAL(trackSplited(int)), this, SLOT(trackSplited(int)));
    connect(gpxmw, SIGNAL(trackCombined(int)), this, SLOT(trackCombined(int)));
    connect(gpxmw, SIGNAL(trackTimeShifted(int, long)), this, SLOT(trackTimeShifted(int, long)));
    connect(gpxmw, SIGNAL(trackSelectionChanged(int, int, int, const GPX_wptType*)), this, SLOT(trackSelectionChanged(int, int, int, const GPX_wptType*)));
    connect(gpxmw, SIGNAL(pointEdited(int, int, int, GPX_wrapper::TrackPointProperty)), this, SLOT(pointEdited(int, int, int, GPX_wrapper::TrackPointProperty)));
    connect(gpxmw, SIGNAL(pointInserted(int, int, int, const GPX_wptType&)), this, SLOT(pointInserted(int, int, int, const GPX_wptType&)));
    connect(gpxmw, SIGNAL(pointDeleted(int, int, int)), this, SLOT(pointDeleted(int, int, int)));
    connect(gpxmw, SIGNAL(pointSelectionChanged(int, const GPX_wptType*)), this, SLOT(pointSelectionChanged(int, const GPX_wptType*)));

    // set window title
    setMainWindowTitle();

    // load settings
    settings = new Settings(this);
    settings->load();
    ui->actionFollow_Item->setChecked(settings->getValue("FollowItem").toBool());
    ui->actionShow_Only_Selected_Track->setChecked(settings->getValue("ShowOnlySelectedItem").toBool());

    // undo stack
    undoStack = new QUndoStack(this);
    undoStack->setUndoLimit(settings->undoLimit);
    QAction *undoAction = undoStack->createUndoAction(this, tr("&Undo"));
    undoAction->setShortcuts(QKeySequence::Undo);
    undoAction->setIcon(QIcon(":/images/undo.png"));
    QAction *redoAction = undoStack->createRedoAction(this, tr("&Redo"));
    redoAction->setShortcuts(QKeySequence::Redo);
    redoAction->setIcon(QIcon(":/images/redo.png"));
    connect(undoStack, SIGNAL(indexChanged(int)), this, SLOT(setMainWindowTitle()));

    // tree widget
    connect(ui->treeTracks, SIGNAL(itemDoubleClicked(QTreeWidgetItem* , int)), this, SLOT(tree_doubleClicked(QTreeWidgetItem*, int)));

    // map widget
    ui->mapWidget->init(gpxmw, undoStack, settings->doPersistentCaching, settings->cachePath);
    ui->mapWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(ui->mapWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(map_showContextMenu(const QPoint&)));
    connect(ui->mapWidget, SIGNAL(viewChanged(const QPointF&, int)), this, SLOT(map_viewChanged(const QPointF&, int)));

    // calendar widget
    ui->calendarWidget->init(gpxmw);

    // table widget
    ui->tableWidgetPoints->init(gpxmw, undoStack);
    connect(settings, SIGNAL(settingsChanged(bool)), ui->tableWidgetPoints, SLOT(settingsChanged(bool)));

    // diagram widget
    ui->diagramWidget->addAction(ui->dockWidgetDiagrams->toggleViewAction());
    ui->diagramWidget->init(gpxmw);

    // status bar widgets
    lblCoordinates = new QLabel();
    statusBar()->addWidget(lblCoordinates);
    lblStatus = new QLabel();
    statusBar()->addWidget(lblStatus);

    // zoom slider widget
    zoomSlider = new QSlider(Qt::Horizontal, this);
    zoomSlider->setMinimumWidth(10);
    zoomSlider->setMaximumWidth(100);
    zoomSlider->setMinimum(0);
    zoomSlider->setMaximum(0);
    ui->mainToolBar->insertWidget(ui->actionMapZoom, zoomSlider);
    connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(zoom_valueChanged(int)));

    // build recent files action
    actionOpenRecentFile = new QAction*[settings->maxRecentFiles];
    for (int i = 0; i < settings->maxRecentFiles; ++i)
    {
        actionOpenRecentFile[i] = new QAction(this);
        actionOpenRecentFile[i]->setVisible(false);
        connect(actionOpenRecentFile[i], SIGNAL(triggered()), this, SLOT(openRecentFile()));
        ui->menuFile->insertAction(ui->actionExit, actionOpenRecentFile[i]);
    }
    ui->menuFile->insertSeparator(ui->actionExit);
    updateRecentFiles();

    // menu edit
    ui->menuEdit->addAction(undoAction);
    ui->menuEdit->addAction(redoAction);

    // menu view
    ui->menuView->addAction(ui->dockWidgetFile->toggleViewAction());
    ui->menuView->addAction(ui->dockWidgetTracks->toggleViewAction());
    ui->menuView->addAction(ui->dockWidgetDiagrams->toggleViewAction());
    ui->menuView->addAction(ui->dockWidgetPoints->toggleViewAction());
    ui->menuView->addAction(ui->mainToolBar->toggleViewAction());
    ui->menuView->addSeparator();
    ui->menuView->addAction(ui->actionRestore_Default_View);

    // install event filters for dock widgets to catch resize events
    ui->dockWidgetFile->installEventFilter(this);
    ui->dockWidgetTracks->installEventFilter(this);
    ui->dockWidgetDiagrams->installEventFilter(this);
    ui->dockWidgetPoints->installEventFilter(this);

    // dock file
    ui->dockWidgetFile->addAction(ui->dockWidgetFile->toggleViewAction());
    ui->dockWidgetFile->addAction(ui->actionEdit_File_Properties);

    // dock tracks
    ui->dockWidgetTracks->addAction(ui->dockWidgetTracks->toggleViewAction());
    ui->dockWidgetTracks->addAction(ui->actionEdit_Track_Properties);
    ui->dockWidgetTracks->addAction(ui->actionGetAltitudeFromSRTM);
    ui->dockWidgetTracks->addAction(ui->actionSetStartTime);

    // dock diagram
    ui->dockWidgetDiagrams->addActions(ui->diagramWidget->actions());

    // dock points
    ui->dockWidgetPoints->addAction(ui->dockWidgetPoints->toggleViewAction());
    ui->dockWidgetPoints->addAction(ui->actionInsert_Point);
    ui->dockWidgetPoints->addAction(ui->actionDelete_Point);

    // default context menu
    addActions(ui->menuView->actions());

    // connect signals for track and point selection
    connect(ui->diagramWidget, SIGNAL(selectionChanged(time_t)), this, SLOT(diagram_selectionChanged(time_t)));
    connect(ui->mapWidget, SIGNAL(selectionChanged(int, int, double, double)), this, SLOT(map_selectionChanged(int, int, double, double)));
    connect(ui->mapWidget, SIGNAL(selectionChanged(int)), this, SLOT(map_selectionChanged(int)));
    connect(ui->tableWidgetPoints, SIGNAL(selectionChanged(int)), this, SLOT(table_selectionChanged(int)));
    connect(ui->treeTracks, SIGNAL(itemSelectionChanged()), this, SLOT(tree_selectionChanged()));
    connect(ui->calendarWidget, SIGNAL(selectionChanged(int)), this, SLOT(cal_selectionChanged(int)));

    // disable actions
    updateActions(false);

    // open file if any passed as argument
    if (!fileName.isEmpty())
    {
        openFile(fileName);
    }
}
Example #9
0
void EPGWidget::reset()
{
    m_channelsWidget->reset();
    m_epgView->reset();
    emit itemSelectionChanged( NULL );
}
Example #10
0
InputSettingsWindow::InputSettingsWindow() {
  activeInput = 0;

  layout = new QVBoxLayout;
  layout->setMargin(Style::WindowMargin);
  layout->setSpacing(Style::WidgetSpacing);
  setLayout(layout);

  list = new QTreeWidget;
  list->setColumnCount(2);
  list->setAllColumnsShowFocus(true);
  list->setSortingEnabled(false);
  list->header()->hide();
  list->header()->setResizeMode(QHeaderView::ResizeToContents);
  layout->addWidget(list);

  controlLayout = new QHBoxLayout;
  layout->addLayout(controlLayout);

  message = new QLabel;
  message->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
  controlLayout->addWidget(message);

  optionButton = new QPushButton("Options");
  controlLayout->addWidget(optionButton);

  optionMenu = new QMenu;
  optionButton->setMenu(optionMenu);

  optionAssignModifiers = new QbCheckAction("Assign Modifiers as Keys", 0);
  optionMenu->addAction(optionAssignModifiers);

  assignButton = new QPushButton("Assign");
  controlLayout->addWidget(assignButton);

  unassignButton = new QPushButton("Unassign");
  controlLayout->addWidget(unassignButton);

  connect(list, SIGNAL(itemSelectionChanged()), this, SLOT(synchronize()));
  connect(list, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(assign()));
  connect(assignButton, SIGNAL(released()), this, SLOT(assign()));
  connect(unassignButton, SIGNAL(released()), this, SLOT(unassign()));

  connect(optionAssignModifiers, SIGNAL(triggered()), this, SLOT(toggleAssignModifiers()));

  //initialize list

  port1 = new QTreeWidgetItem(list);
  port1->setData(0, Qt::UserRole, QVariant(-1));
  port1->setText(0, "Controller Port 1");

  port2 = new QTreeWidgetItem(list);
  port2->setData(0, Qt::UserRole, QVariant(-1));
  port2->setText(0, "Controller Port 2");

  userInterface = new QTreeWidgetItem(list);
  userInterface->setData(0, Qt::UserRole, QVariant(-1));
  userInterface->setText(0, "User Interface");

  for(unsigned i = 0; i < mapper().size(); i++) {
    InputGroup &group = *(mapper()[i]);

    QTreeWidgetItem *grandparent = 0;
    if(group.category == InputCategory::Port1) { grandparent = port1; }
    if(group.category == InputCategory::Port2) { grandparent = port2; }
    if(group.category == InputCategory::UserInterface) { grandparent = userInterface; }
    if(!grandparent) continue;

    QTreeWidgetItem *parent = new QTreeWidgetItem(grandparent);
    parent->setData(0, Qt::UserRole, QVariant(-1));
    parent->setText(0, group.label);

    for(unsigned i = 0; i < group.size(); i++) {
      QTreeWidgetItem *child = new QTreeWidgetItem(parent);
      child->setData(0, Qt::UserRole, QVariant(inputTable.size()));
      inputTable.add(group[i]);
    }
  }

  updateList();
  synchronize();
}
Example #11
0
QWidget* ExtensionDialog::CreateWidget( extension_widget_t *p_widget )
{
    QLabel *label = NULL;
    QPushButton *button = NULL;
    QTextBrowser *textArea = NULL;
    QLineEdit *textInput = NULL;
    QCheckBox *checkBox = NULL;
    QComboBox *comboBox = NULL;
    QListWidget *list = NULL;
    struct extension_widget_t::extension_widget_value_t *p_value = NULL;

    assert( p_widget->p_sys_intf == NULL );

    switch( p_widget->type )
    {
        case EXTENSION_WIDGET_LABEL:
            label = new QLabel( qfu( p_widget->psz_text ), this );
            p_widget->p_sys_intf = label;
            label->setTextFormat( Qt::RichText );
            label->setOpenExternalLinks( true );
            return label;

        case EXTENSION_WIDGET_BUTTON:
            button = new QPushButton( qfu( p_widget->psz_text ), this );
            clickMapper->setMapping( button, new WidgetMapper( p_widget ) );
            CONNECT( button, clicked(), clickMapper, map() );
            p_widget->p_sys_intf = button;
            return button;

        case EXTENSION_WIDGET_IMAGE:
            label = new QLabel( this );
            label->setPixmap( QPixmap( qfu( p_widget->psz_text ) ) );
            if( p_widget->i_width > 0 )
                label->setMaximumWidth( p_widget->i_width );
            if( p_widget->i_height > 0 )
                label->setMaximumHeight( p_widget->i_height );
            label->setScaledContents( true );
            p_widget->p_sys_intf = label;
            return label;

        case EXTENSION_WIDGET_HTML:
            textArea = new QTextBrowser( this );
            textArea->setOpenExternalLinks( true );
            textArea->setHtml( qfu( p_widget->psz_text ) );
            p_widget->p_sys_intf = textArea;
            return textArea;

        case EXTENSION_WIDGET_TEXT_FIELD:
            textInput = new QLineEdit( this );
            textInput->setText( qfu( p_widget->psz_text ) );
            textInput->setReadOnly( false );
            textInput->setEchoMode( QLineEdit::Normal );
            inputMapper->setMapping( textInput, new WidgetMapper( p_widget ) );
            /// @note: maybe it would be wiser to use textEdited here?
            CONNECT( textInput, textChanged(const QString &),
                     inputMapper, map() );
            p_widget->p_sys_intf = textInput;
            return textInput;

        case EXTENSION_WIDGET_PASSWORD:
            textInput = new QLineEdit( this );
            textInput->setText( qfu( p_widget->psz_text ) );
            textInput->setReadOnly( false );
            textInput->setEchoMode( QLineEdit::Password );
            inputMapper->setMapping( textInput, new WidgetMapper( p_widget ) );
            /// @note: maybe it would be wiser to use textEdited here?
            CONNECT( textInput, textChanged(const QString &),
                     inputMapper, map() );
            p_widget->p_sys_intf = textInput;
            return textInput;

        case EXTENSION_WIDGET_CHECK_BOX:
            checkBox = new QCheckBox( this );
            checkBox->setText( qfu( p_widget->psz_text ) );
            checkBox->setChecked( p_widget->b_checked );
            clickMapper->setMapping( checkBox, new WidgetMapper( p_widget ) );
            CONNECT( checkBox, stateChanged( int ), clickMapper, map() );
            p_widget->p_sys_intf = checkBox;
            return checkBox;

        case EXTENSION_WIDGET_DROPDOWN:
            comboBox = new QComboBox( this );
            comboBox->setEditable( false );
            for( p_value = p_widget->p_values;
                 p_value != NULL;
                 p_value = p_value->p_next )
            {
                comboBox->addItem( qfu( p_value->psz_text ), p_value->i_id );
            }
            /* Set current item */
            if( p_widget->psz_text )
            {
                int idx = comboBox->findText( qfu( p_widget->psz_text ) );
                if( idx >= 0 )
                    comboBox->setCurrentIndex( idx );
            }
            selectMapper->setMapping( comboBox, new WidgetMapper( p_widget ) );
            CONNECT( comboBox, currentIndexChanged( const QString& ),
                     selectMapper, map() );
            return comboBox;

        case EXTENSION_WIDGET_LIST:
            list = new QListWidget( this );
            list->setSelectionMode( QAbstractItemView::ExtendedSelection );
            for( p_value = p_widget->p_values;
                 p_value != NULL;
                 p_value = p_value->p_next )
            {
                QListWidgetItem *item =
                    new QListWidgetItem( qfu( p_value->psz_text ) );
                item->setData( Qt::UserRole, p_value->i_id );
                list->addItem( item );
            }
            selectMapper->setMapping( list, new WidgetMapper( p_widget ) );
            CONNECT( list, itemSelectionChanged(),
                     selectMapper, map() );
            return list;

        default:
            msg_Err( p_intf, "Widget type %d unknown", p_widget->type );
            return NULL;
    }
}
	QFont boldFont = ui->treeWidget->font();
	boldFont.setBold(true);

	//
	camerasItem->setText(0, tr("Cameras"));
	camerasItem->setFont(0, boldFont);
	camerasItem->setExpanded(true);
	ui->treeWidget->addTopLevelItem(camerasItem);

	imageSetsItem->setText(0, tr("Image Sets"));
	imageSetsItem->setFont(0, boldFont);
	imageSetsItem->setExpanded(true);
	ui->treeWidget->addTopLevelItem(imageSetsItem);

	//
	connect(ui->treeWidget, SIGNAL(itemSelectionChanged()), SLOT(projectTreeSelectionChanged()) );
	connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), SLOT(forwardPopupMenu(QPoint)));
}

ProjectExplorer::~ProjectExplorer() {
    delete ui;
}

//---------------------------------------------------------------------

void ProjectExplorer::forwardPopupMenu(const QPoint &p) {
	emit customContextMenuRequested(ui->treeWidget->mapToParent(p));
}

//---------------------------------------------------------------------
Settings::FaceManagementPage::FaceManagementPage(QWidget* parent) : QWidget(parent)
{
    // The main layout
    QVBoxLayout* mainLayout = new QVBoxLayout(this);

    ////////////////////////////////
    // The detection settings box //
    ////////////////////////////////

    QGroupBox* detectionBox = new QGroupBox(i18n("Face detection"));
    mainLayout->addWidget(detectionBox);

    // The detection settings layout
    QGridLayout* detectionLayout = new QGridLayout(detectionBox);

    // Speed

    QLabel* speedLabel = new QLabel(i18n("Accuracy"));
    speedLabel->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
    detectionLayout->addWidget(speedLabel, 0, 1);

    QLabel* fastLabel = new QLabel(i18n("fast"));
    fastLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
    detectionLayout->addWidget(fastLabel, 1, 0);

    m_speedSlider = new QSlider(Qt::Horizontal);
    m_speedSlider->setMaximum(100);
    m_speedSlider->setTickInterval(10);
    m_speedSlider->setTickPosition(QSlider::TicksBothSides);
    detectionLayout->addWidget(m_speedSlider, 1, 1);

    QLabel* accurateLabel = new QLabel(i18n("accurate"));
    detectionLayout->addWidget(accurateLabel, 1, 2);

    // Sensitivity

    QLabel* sensitivityLabel = new QLabel(i18n("Sensitivity"));
    sensitivityLabel->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
    detectionLayout->addWidget(sensitivityLabel, 2, 1);

    QLabel* falsePositivesLabel = new QLabel(i18n("more false positives"));
    falsePositivesLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
    detectionLayout->addWidget(falsePositivesLabel, 3, 0);

    m_sensitivitySlider = new QSlider(Qt::Horizontal);
    m_sensitivitySlider->setMaximum(100);
    m_sensitivitySlider->setTickInterval(10);
    m_sensitivitySlider->setTickPosition(QSlider::TicksBothSides);
    detectionLayout->addWidget(m_sensitivitySlider, 3, 1);

    QLabel* missedFacesLabel = new QLabel(i18n("more missed faces"));
    detectionLayout->addWidget(missedFacesLabel, 3, 2);

    // Make the detection settings box as small as possible
    QSizePolicy detectionPolicy;
    detectionPolicy.setHorizontalPolicy(QSizePolicy::Minimum);
    detectionBox->setSizePolicy(detectionPolicy);

    //////////////////////////////////
    // The recognition database box //
    //////////////////////////////////

    QGroupBox* recognitionBox = new QGroupBox(i18n("Face recognition"));
    mainLayout->addWidget(recognitionBox);

    // The detection settings layout
    QGridLayout* recognitionLayout = new QGridLayout(recognitionBox);

    // List of all database entries
    m_databaseEntries = new QTreeWidget;
    m_databaseEntries->setColumnCount(2);
    m_databaseEntries->setHeaderLabels(QStringList() << i18n("Database entry")
                                                     << i18n("Trained faces"));
    m_databaseEntries->setSortingEnabled(true);
    m_databaseEntries->setSelectionMode(QAbstractItemView::ExtendedSelection);
    clearDatabaseEntries();
    recognitionLayout->addWidget(m_databaseEntries, 0, 0, 3, 1);

    // Take as much space as possible for the database entries list
    QSizePolicy databaseEntriesPolicy;
    databaseEntriesPolicy.setHorizontalPolicy(QSizePolicy::Expanding);
    databaseEntriesPolicy.setVerticalPolicy(QSizePolicy::Expanding);
    m_databaseEntries->setSizePolicy(databaseEntriesPolicy);

    connect(m_databaseEntries, SIGNAL(itemSelectionChanged()), this, SLOT(checkSelection()));

    // The "Delete selected" button
    m_deleteSelectedButton = new QPushButton(i18n("Delete selected"));
    m_deleteSelectedButton->setEnabled(false);
    recognitionLayout->addWidget(m_deleteSelectedButton, 1, 1);
    connect(m_deleteSelectedButton, SIGNAL(clicked()), this, SLOT(slotDeleteSelected()));

    // The "Erase database" button
    QPushButton* eraseButton = new QPushButton(i18n("Erase database"));
    recognitionLayout->addWidget(eraseButton, 2, 1);
    connect(eraseButton, SIGNAL(clicked()), this, SLOT(slotEraseDatabase()));

    QLabel* cautionLabel = new QLabel(i18n(
        "<b>Caution:</b> Changes to category names or category deletions are not "
        "adopted by the recognition database until the changes are saved!"), this);
    mainLayout->addWidget(cautionLabel);
    cautionLabel->setSizePolicy(detectionPolicy);
}
Example #14
0
KDMThemeWidget::KDMThemeWidget(QWidget *parent)
    : QWidget(parent)
{
    QGridLayout *ml = new QGridLayout(this);
    ml->setSizeConstraint(QLayout::SetMinAndMaxSize);
    ml->setSpacing(KDialog::spacingHint());
    ml->setMargin(KDialog::marginHint());

    themeWidget = new QTreeWidget(this);
    themeWidget->setHeaderLabels(QStringList()
                                 << i18nc("@title:column", "Theme")
                                 << i18nc("@title:column", "Author"));
    themeWidget->setSortingEnabled(true);
    themeWidget->sortItems(0, Qt::AscendingOrder);
    themeWidget->setRootIsDecorated(false);
    themeWidget->setWhatsThis(i18n("This is a list of installed themes.\n"
                                   "Click the one to be used."));

    ml->addWidget(themeWidget, 0, 0, 2, 4);

    preview = new QLabel(this);
    preview->setFixedSize(QSize(200, 150));
    preview->setScaledContents(true);
    preview->setWhatsThis(i18n("This is a screen shot of what KDM will look like."));

    ml->addWidget(preview, 0, 4);

    info = new QLabel(this);
    info->setMaximumWidth(200);
    info->setAlignment(Qt::AlignTop);
    info->setWordWrap(true);
    info->setWhatsThis(i18n("This contains information about the selected theme."));

    ml->addWidget(info, 1, 4);

    bInstallTheme = new QPushButton(i18nc("@action:button", "Install &new theme"), this);
    bInstallTheme->setWhatsThis(i18n("This will install a theme into the theme directory."));

    ml->addWidget(bInstallTheme, 2, 0);

    bRemoveTheme = new QPushButton(i18nc("@action:button", "&Remove theme"), this);
    bRemoveTheme->setWhatsThis(i18n("This will remove the selected theme."));

    ml->addWidget(bRemoveTheme, 2, 1);

    bGetNewThemes = new QPushButton(i18nc("@action:button", "&Get New Themes"), this);

    ml->addWidget(bGetNewThemes, 2, 2);

    connect(themeWidget, SIGNAL(itemSelectionChanged()), SLOT(themeSelected()));
    connect(bInstallTheme, SIGNAL(clicked()), SLOT(installNewTheme()));
    connect(bRemoveTheme, SIGNAL(clicked()), SLOT(removeSelectedThemes()));
    connect(bGetNewThemes, SIGNAL(clicked()), SLOT(getNewStuff()));

    themeDir = KStandardDirs::installPath("data") + "kdm/themes/";
    defaultTheme = 0;

    foreach (const QString &ent,
             QDir(themeDir).entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Unsorted))
        insertTheme(themeDir + ent);
}
Example #15
0
Wizard::Wizard(QWidget* const parent, GalleryInfo* const info)
    : KPWizardDialog(parent)
{
    d        = new Private;
    d->mInfo = info;

    setCaption(i18n("Export image collections to HTML pages"));

    // ---------------------------------------------------------------
    // About data and help button.

    KPAboutData* about = new KPAboutData(
                                ki18n("HTML Export"),
                                QByteArray(),
                                KAboutLicense::GPL,
                                ki18n("A KIPI plugin to export image collections to HTML pages"),
                                ki18n("(c) 2006-2009, Aurelien Gateau\n"
                                      "(c) 2010, Gianluca Urgese"));

    about->addAuthor(
        ki18n("Gianluca Urgese"),
        ki18n("Maintainer"),
        "*****@*****.**");

    about->addAuthor(
        ki18n("Aurelien Gateau"),
        ki18n("Former Author and Maintainer"),
        "*****@*****.**");

    about->setHandbookEntry("htmlexport");
    setAboutData(about);

    // ---------------------------------------------------------------

    d->mCollectionSelector     = iface()->imageCollectionSelector(this);
    d->mCollectionSelectorPage = addPage(d->mCollectionSelector, i18n("Collection Selection"));
    updateCollectionSelectorPageValidity();

    connect(d->mCollectionSelector, SIGNAL(selectionChanged()),
            this, SLOT(updateCollectionSelectorPageValidity()));

    d->mThemePage = new ThemePage(this, i18n("Theme"));
    d->initThemePage();

    connect(d->mThemePage->mThemeList, SIGNAL(itemSelectionChanged()),
            this, SLOT(slotThemeSelectionChanged()) );

    d->mThemeParametersPage = new ThemeParametersPage(this, i18n("Theme Parameters"));
    d->mImageSettingsPage   = new ImageSettingsPage(this, i18n("Image Settings"));
    d->mOutputPage          = new OutputPage(this, i18n("Output"));
    d->mOutputPage->kcfg_destUrl->setMode(KFile::Directory);

    connect(d->mOutputPage->kcfg_destUrl, SIGNAL(textChanged(QString)),
            this, SLOT(updateFinishPageValidity()) );

    d->mConfigManager = new KConfigDialogManager(this, d->mInfo);
    d->mConfigManager->updateWidgets();

    // Set page states
    // Pages can only be disabled after they have *all* been added!
    slotThemeSelectionChanged();
    updateFinishPageValidity();
}
Example #16
0
	return QString::number(valuation, 'f', 1);
}

QString MoveBox::formatWinPercentage(double winPercentage)
{
	return QString::number(winPercentage * 100.0, 'f', 2);
}

void MoveBox::setSelectionWatchingEnabled(bool enabled)
{
	if (enabled)
	{
		connect(m_treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));

		// the former is single-click to select on all platforms,
		// latter is always double-click to select on most platforms
		connect(m_treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(moveActivated(QTreeWidgetItem *)));
		//connect(m_treeWidget, SIGNAL(itemActivated(QTreeWidgetItem *, int)), this, SLOT(moveActivated(QTreeWidgetItem *)));

		// to allow the arrow keys to be used to select moves
		// connect(m_treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(moveActivated(QTreeWidgetItem *)));
	}
	else
	{
		disconnect(m_treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));
		disconnect(m_treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(moveActivated(QTreeWidgetItem *)));
		// disconnect(m_treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(moveActivated(QTreeWidgetItem *)));
	}
}

Example #17
0
SinglePopupEditor::SinglePopupEditor(QWidget * par)
    : QWidget(par)
{
	m_pLastSelectedItem = nullptr;
	m_pContextPopup = new QMenu(this);
	m_pClipboard = nullptr;
	m_pTestPopup = nullptr;

	QGridLayout * g = new QGridLayout(this);
	g->setMargin(0);
	g->setSpacing(2);

	m_pNameEditor = new QLineEdit(this);
	m_pNameEditor->setToolTip(__tr2qs_ctx("Popup name", "editor"));

	g->addWidget(m_pNameEditor, 0, 0, 1, 2);

	m_pMenuButton = new QPushButton(__tr2qs_ctx("Test", "editor"), this);
	g->addWidget(m_pMenuButton, 0, 2);
	connect(m_pMenuButton, SIGNAL(clicked()), this, SLOT(testPopup()));
	QSplitter * spl = new QSplitter(Qt::Vertical, this);
	spl->setObjectName("popupeditor_vertical_splitter");
	spl->setChildrenCollapsible(false);

	m_pTreeWidget = new QTreeWidget(spl);
	m_pTreeWidget->setColumnCount(2);
	QStringList labels;
	labels << __tr2qs_ctx("Item", "editor") << __tr2qs_ctx("Type", "editor");
	m_pTreeWidget->setHeaderLabels(labels);
	m_pTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
	m_pTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
	m_pTreeWidget->setAllColumnsShowFocus(true);
	m_pTreeWidget->setRootIsDecorated(true);
	m_pTreeWidget->header()->setSortIndicatorShown(false);
	m_pTreeWidget->setSortingEnabled(false);
	m_pTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);

	connect(m_pTreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));
	connect(m_pTreeWidget, SIGNAL(customContextMenuRequested(const QPoint &)),
	    this, SLOT(customContextMenuRequested(const QPoint &)));

	m_pEditor = KviScriptEditor::createInstance(spl);

	g->addWidget(spl, 1, 0, 1, 3);

	QLabel * l = new QLabel(__tr2qs_ctx("Text:", "editor"), this);
	g->addWidget(l, 2, 0);

	m_pTextEditor = new QLineEdit(this);
	m_pTextEditor->setToolTip(
	    __tr2qs_ctx("<b>Visible text</b><br>May contain identifiers that will be evaluated at popup call time.<br>For labels, this text can contain also limited HTML tags.", "editor"));
	g->addWidget(m_pTextEditor, 2, 1, 1, 2);

	l = new QLabel(__tr2qs_ctx("Condition:", "editor"), this);
	l->setMargin(2);
	g->addWidget(l, 3, 0);

	m_pConditionEditor = new QLineEdit(this);
	m_pConditionEditor->setToolTip(
	    __tr2qs_ctx("<b>Boolean condition</b><br>Will be evaluated at popup call time in order to decide if this entry has to be shown.<br>An empty condition evaluates to true.", "editor"));
	g->addWidget(m_pConditionEditor, 3, 1, 1, 2);

	l = new QLabel(__tr2qs_ctx("Icon:", "editor"), this);
	l->setMargin(2);
	g->addWidget(l, 4, 0);

	m_pIconEditor = new QLineEdit(this);
	m_pIconEditor->setToolTip(
	    __tr2qs_ctx("<b>Icon identifier</b><br>May be an internal icon ID, an absolute path or a relative path.<br>Portable scripts should never use absolute paths.", "editor"));
	g->addWidget(m_pIconEditor, 4, 1, 1, 2);

	l = new QLabel(__tr2qs_ctx("External menu:", "editor"), this);
	l->setMargin(2);
	g->addWidget(l, 5, 0);

	m_pExtNameEditor = new QLineEdit(this);
	m_pExtNameEditor->setToolTip(
	    __tr2qs_ctx("<b>External menu name</b><br>This allows one to nest externally defined popup menus. The popup menu with the specified name will be looked up at menu setup time.", "editor"));
	g->addWidget(m_pExtNameEditor, 5, 1, 1, 2);

	l = new QLabel(__tr2qs_ctx("Item ID:", "editor"), this);
	l->setMargin(2);
	g->addWidget(l, 6, 0);

	m_pIdEditor = new QLineEdit(this);
	m_pIdEditor->setToolTip(
	    __tr2qs_ctx("<b>Item ID</b><br>This will allow you to use delpopupitem later.", "editor"));
	g->addWidget(m_pIdEditor, 6, 1, 1, 2);
	g->setColumnStretch(1, 1);
	g->setRowStretch(1, 1);
}
Example #18
0
ECEditorWindow::ECEditorWindow(Framework* fw, QWidget *parent) :
    QWidget(parent),
    framework(fw),
    ecBrowser(0),
    hasFocus(true)
{
    /// @todo Create UI fully in code (very simple UI file).
    setupUi(this);
    installEventFilter(this);

    Scene *scene = fw->Scene()->MainCameraScene();
    assert(scene);
    undoManager_ = new UndoManager(scene->shared_from_this(), this);
    transformEditor = new TransformEditor(scene->shared_from_this(), undoManager_);

    undoButton->setDisabled(true);
    redoButton->setDisabled(true);

    undoButton->setIcon(QIcon(Application::InstallationDirectory() + "data/ui/images/icon/undo-icon.png"));
    redoButton->setIcon(QIcon(Application::InstallationDirectory() + "data/ui/images/icon/redo-icon.png"));

    undoButton->setMenu(undoManager_->UndoMenu());
    redoButton->setMenu(undoManager_->RedoMenu());

    entityWidget->hide();

    ecBrowser = new ECBrowser(framework, this, browserWidget);
    ecBrowser->setMinimumWidth(100);
    browserWidget->layout()->addWidget(ecBrowser);

    // signals from attribute browser to editor window.
    connect(ecBrowser, SIGNAL(ShowXmlEditorForComponent(const QString &)), SLOT(ShowXmlEditorForComponent(const QString &)));
    connect(ecBrowser, SIGNAL(CreateNewComponent()), SLOT(CreateComponent()));
    connect(ecBrowser, SIGNAL(SelectionChanged(const QString&, const QString &, const QString&, const QString&)),
        SLOT(HighlightEntities(const QString&, const QString&)));
    connect(ecBrowser, SIGNAL(SelectionChanged(const QString&, const QString &, const QString&, const QString&)),
        SIGNAL(SelectionChanged(const QString&, const QString&, const QString&, const QString&)), Qt::UniqueConnection);

    ECEditorModule *ecEditorModule = framework->Module<ECEditorModule>();
    ecBrowser->SetItemExpandMemory(ecEditorModule->ExpandMemory());

    entityList->setSelectionMode(QAbstractItemView::ExtendedSelection);
    connect(entityList, SIGNAL(itemSelectionChanged()), this, SLOT(Refresh()));
    connect(entityList, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(ShowEntityContextMenu(const QPoint &)));

    connect(toggleEntitiesButton, SIGNAL(pressed()), this, SLOT(ToggleEntityList()));
    connect(expandOrCollapseButton, SIGNAL(clicked()), ecBrowser, SLOT(ExpandOrCollapseAll()));

    connect(scene, SIGNAL(EntityRemoved(Entity*, AttributeChange::Type)), SLOT(RemoveEntity(Entity*)), Qt::UniqueConnection);
    connect(scene, SIGNAL(ActionTriggered(Entity *, const QString &, const QStringList &, EntityAction::ExecTypeField)),
        SLOT(OnActionTriggered(Entity *, const QString &, const QStringList &)), Qt::UniqueConnection);

    connect(this, SIGNAL(FocusChanged(ECEditorWindow *)), ecEditorModule, SLOT(ECEditorFocusChanged(ECEditorWindow*)));
    connect(this, SIGNAL(EditEntityXml(const QList<EntityPtr> &)), ecEditorModule, SLOT(CreateXmlEditor(const QList<EntityPtr> &)));
    connect(this, SIGNAL(EditComponentXml(const QList<ComponentPtr> &)), ecEditorModule, SLOT(CreateXmlEditor(const QList<ComponentPtr> &)));
    //connect(this, SIGNAL(AttributeAboutToBeEdited(IAttribute *)), this, SLOT(OnAboutToEditAttribute(IAttribute* )));
    connect(undoManager_, SIGNAL(CanUndoChanged(bool)), this, SLOT(OnUndoChanged(bool)));
    connect(undoManager_, SIGNAL(CanRedoChanged(bool)), this, SLOT(OnRedoChanged(bool)));
    connect(undoButton, SIGNAL(clicked()), undoManager_, SLOT(Undo()));
    connect(redoButton, SIGNAL(clicked()), undoManager_, SLOT(Redo()));

    connect(framework->Input()->TopLevelInputContext(), SIGNAL(KeyPressed(KeyEvent*)), SLOT(OnKeyEvent(KeyEvent*)));

    // Make sure the editor is cleared if the scene is cleared or removed.
    connect(scene, SIGNAL(SceneCleared(Scene *)), SLOT(OnSceneRemoved(Scene *)));
    connect(framework->Scene(), SIGNAL(SceneAboutToBeRemoved(Scene *, AttributeChange::Type)), SLOT(OnSceneRemoved(Scene *)));
}
Example #19
0
DeviceStack::DeviceStack(
        QWidget *parent, virConnectPtr *conn) :
    QDialog(parent), ptr_ConnPtr(conn)
{
    infoLayout = new QVBoxLayout(this);
    infoWidget = new QScrollArea(this);
    scrolled = new QWidget(this);
    scrolled->setLayout(infoLayout);
    infoWidget->setWidget(scrolled);
    infoWidget->setWidgetResizable(true);
    QString connType = QString(virConnectGetType(*ptr_ConnPtr)).toLower();
    QStringList devSet, devList, devType;
    devList = DEV_LIST;
    devType = DEV_TYPE;
    if ( connType=="qemu" ) {
        devSet = QEMU_DEVICE_LIST;
    } else if ( connType=="lxc" ) {
        devSet = LXC_DEVICE_LIST;
    } else if ( connType=="xen" ) {
        devSet = XEN_DEVICE_LIST;
    } else if ( connType=="vbox" ) {
        devSet = VBOX_DEVICE_LIST;
    } else if ( connType=="vbox" ) {
        devSet = VMWARE_DEVICE_LIST;
    } else if ( connType=="vbox" ) {
        devSet = OPENVZ_DEVICE_LIST;
    };
    deviceList = new QListWidget(this);
    deviceList->setSortingEnabled(false);
    /* set icons & user data */
    for (int i=0; i<devList.count();i++) {
        if ( devSet.contains(devType.at(i)) ) {
            deviceList->addItem(devList.at(i));
            QListWidgetItem *item = deviceList->item(deviceList->count()-1);
            /*
            item->setIcon(
                  QIcon::fromTheme(
                         item->text()
                         .split(" ")
                         .first()
                         .toLower()));
             */
            item->setData(Qt::UserRole, QVariant(devType.at(i)));
            //qDebug()<<item->text();
        };
    };

    // double event for selection item
    //connect(deviceList, SIGNAL(itemClicked(QListWidgetItem*)),
    //        this, SLOT(showDevice(QListWidgetItem*)));
    connect(deviceList, SIGNAL(itemSelectionChanged()),
            this, SLOT(showDevice()));
    listLayout = new QHBoxLayout(this);
    listLayout->addWidget(deviceList, 3);
    listLayout->addWidget(infoWidget, 8);
    listWidget = new QWidget(this);
    listWidget->setLayout(listLayout);

    addDevice = new QPushButton(QIcon::fromTheme("dialog-ok"), "Add Device", this);
    cancel = new QPushButton(QIcon::fromTheme("dialog-cancel"), "Cancel", this);
    connect(addDevice, SIGNAL(clicked()), this, SLOT(set_Result()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(set_Result()));
    buttonlayout = new QHBoxLayout(this);
    buttonlayout->addWidget(addDevice);
    buttonlayout->addWidget(cancel);
    buttons = new QWidget(this);
    buttons->setLayout(buttonlayout);

    commonLayout = new QVBoxLayout(this);
    commonLayout->addWidget(listWidget);
    commonLayout->addWidget(buttons);
    setLayout(commonLayout);
}
Example #20
0
AddFixture::AddFixture(QWidget* parent, const Doc* doc, const Fixture* fxi)
    : QDialog(parent)
    , m_doc(doc)
{
    m_addressValue = 0;
    m_universeValue = 0;
    m_amountValue = 1;
    m_gapValue = 0;
    m_channelsValue = 1;
    m_fixtureDef = NULL;
    m_mode = NULL;
    m_fxiCount = 0;
    m_fixtureID = Fixture::invalidId();
    m_invalidAddressFlag = false;

    setupUi(this);
    m_addrErrorLabel->hide();

    QAction* action = new QAction(this);
    action->setShortcut(QKeySequence(QKeySequence::Close));
    connect(action, SIGNAL(triggered(bool)), this, SLOT(reject()));
    addAction(action);

    connect(m_tree, SIGNAL(itemSelectionChanged()),
            this, SLOT(slotSelectionChanged()));
    connect(m_tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
            this, SLOT(slotTreeDoubleClicked(QTreeWidgetItem*)));
    connect(m_modeCombo, SIGNAL(activated(const QString&)),
            this, SLOT(slotModeActivated(const QString&)));
    connect(m_universeCombo, SIGNAL(activated(int)),
            this, SLOT(slotUniverseActivated(int)));
    connect(m_addressSpin, SIGNAL(valueChanged(int)),
            this, SLOT(slotAddressChanged(int)));
    connect(m_channelsSpin, SIGNAL(valueChanged(int)),
            this, SLOT(slotChannelsChanged(int)));
    connect(m_nameEdit, SIGNAL(textEdited(const QString&)),
            this, SLOT(slotNameEdited(const QString&)));
    connect(m_gapSpin, SIGNAL(valueChanged(int)),
            this, SLOT(slotGapSpinChanged(int)));
    connect(m_amountSpin, SIGNAL(valueChanged(int)),
            this, SLOT(slotAmountSpinChanged(int)));
    connect(m_searchEdit, SIGNAL(textChanged(QString)),
            this, SLOT(slotSearchFilterChanged(QString)));
    connect(m_diptoolButton, SIGNAL(clicked()),
            this, SLOT(slotDiptoolButtonClicked()));

    /* Fill fixture definition tree (and select a fixture def) */
    if (fxi != NULL)
    {
        fillTree(fxi->fixtureDef()->manufacturer(), fxi->fixtureDef()->model());
        m_fixtureID = fxi->id();
    }
    else
        fillTree(KXMLFixtureGeneric, KXMLFixtureGeneric);

    m_fixturesCount->setText(tr("Fixtures found: %1").arg(m_fxiCount));

    /* Fill universe combo with available universes */
    m_universeCombo->addItems(m_doc->inputOutputMap()->universeNames());

    /* Simulate first selection and find the next free address */
    slotSelectionChanged();

    if (fxi != NULL)
    {
        // Universe
        m_universeCombo->setCurrentIndex(fxi->universe());
        slotUniverseActivated(fxi->universe());

        m_addressSpin->setValue(fxi->address() + 1);
        m_addressValue = fxi->address();

        m_multipleGroup->setEnabled(false);

        // Name
        m_nameEdit->setText(fxi->name());
        slotNameEdited(fxi->name());
        m_nameEdit->setModified(true); // Prevent auto-naming

        // Mode
        int index = m_modeCombo->findText(fxi->fixtureMode()->name());
        if (index != -1)
        {
            m_channelsSpin->setValue(fxi->channels());
            m_modeCombo->setCurrentIndex(index);
            slotModeActivated(m_modeCombo->itemText(index));
        }
    }
    else
    {
        slotUniverseActivated(0);
        findAddress();

        m_channelsSpin->setValue(1);
    }

    QSettings settings;
    QVariant var = settings.value(SETTINGS_GEOMETRY);
    if (var.isValid() == true)
        restoreGeometry(var.toByteArray());
    AppUtil::ensureWidgetIsVisible(this);
}
Example #21
0
userPreferences::userPreferences(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
  setupUi(this);

  _pref = _preferences;
  _altPref = 0;

  if(!_privileges->check("MaintainPreferencesOthers"))
    _selectedUser->setEnabled(false);

  connect(_backgroundList,SIGNAL(clicked()),     this, SLOT(sBackgroundList()));
  connect(_close,         SIGNAL(clicked()),     this, SLOT(sClose()));
  connect(_save,          SIGNAL(clicked()),     this, SLOT(sSave()));
  connect(_selectedUser,  SIGNAL(toggled(bool)), this, SLOT(sPopulate()));
  connect(_user,          SIGNAL(newID(int)),    this, SLOT(sPopulate()));
    //hot key signals and slots connections
  connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_close, SIGNAL(clicked()), this, SLOT(sClose()));
  connect(_hotkey, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
  connect(_hotkey, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
  connect(_hotkey, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));

  _hotkey->addColumn(tr("Keystroke"), _itemColumn, Qt::AlignLeft );
  _hotkey->addColumn(tr("Action"),    -1,          Qt::AlignLeft );
  _hotkey->addColumn("key",           0,           Qt::AlignLeft );

  connect(_warehouses, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(sWarehouseToggled(QTreeWidgetItem*)));
  connect(_event, SIGNAL(itemSelected(int)), this, SLOT(sAllWarehousesToggled(int)));
  connect(_event, SIGNAL(itemSelectionChanged()), this, SLOT(sFillWarehouseList()));

  _event->addColumn(tr("Module"),      50,   Qt::AlignCenter, true,  "evnttype_module" );
  _event->addColumn(tr("Name"),        150,  Qt::AlignLeft,   true,  "evnttype_name"   );
  _event->addColumn(tr("Description"), -1,   Qt::AlignLeft,   true,  "evnttype_descrip"   );
  _event->populate( "SELECT evnttype_id, evnttype_module, evnttype_name, evnttype_descrip "
                    "FROM evnttype "
                    "ORDER BY evnttype_module, evnttype_name" );

  _warehouses->addColumn(tr("Notify"),      50,         Qt::AlignCenter, true,  "notify" );
  _warehouses->addColumn(tr("Site"),        _whsColumn, Qt::AlignCenter, true,  "warehous_code" );
  _warehouses->addColumn(tr("Description"), -1,         Qt::AlignLeft,   true,  "warehous_descrip"   );
  _warehouses->populate( "SELECT warehous_id, TEXT('-') AS notify, warehous_code, warehous_descrip "
                        "FROM warehous "
                        "ORDER BY warehous_code" );

  _dirty = FALSE;

#ifndef Q_WS_MAC
  _backgroundList->setMaximumWidth(25);
#endif

  _user->setType(XComboBox::Users);

  _userGroup->setEnabled(_privileges->check("MaintainUsers"));

  _ellipsesAction->append(1, tr("List"));
  _ellipsesAction->append(2, tr("Search"));

  //resize(minimumSize());
  sPopulate();
}
Example #22
0
/*!
  Setup our basic widget layout, ready for the pages
*/
void VkOptionsDialog::setupLayout()
{
   // ------------------------------------------------------------
   // top layout
   QVBoxLayout* vLayout = new QVBoxLayout( this );
   vLayout->setObjectName( QString::fromUtf8( "vlayout" ) );
   
   // ------------------------------------------------------------
   // parent widget for the contents + pages
   QWidget* hLayoutWidget = new QWidget( this );
   hLayoutWidget->setObjectName( QString::fromUtf8( "hLayoutWidget" ) );
   vLayout->addWidget( hLayoutWidget );
   
   // ------------------------------------------------------------
   // contents + pages layout
   QHBoxLayout* hLayout = new QHBoxLayout( hLayoutWidget );
   hLayout->setObjectName( QString::fromUtf8( "hLayout" ) );
   hLayout->setContentsMargins( 0, 0, 0, 0 );
   
   // ------------------------------------------------------------
   // The contents list
   // Note: give this its maximum width once filled with items
   contentsListWidget = new QListWidget( hLayoutWidget );
   contentsListWidget->setObjectName( QString::fromUtf8( "contentsListWidget" ) );
   contentsListWidget->setEditTriggers( QAbstractItemView::NoEditTriggers );
   contentsListWidget->setSortingEnabled( false );
   QSizePolicy sizePolicyContents( QSizePolicy::Maximum, QSizePolicy::Expanding );
   contentsListWidget->setSizePolicy( sizePolicyContents );
   contentsListWidget->setSelectionMode( QAbstractItemView::SingleSelection );
   hLayout->addWidget( contentsListWidget );
   
   optionPages = new QStackedWidget( hLayoutWidget );
   optionPages->setObjectName( QString::fromUtf8( "optionPages" ) );
   optionPages->setFrameShape( QFrame::StyledPanel );
   optionPages->setFrameShadow( QFrame::Raised );
   hLayout->addWidget( optionPages );
   
   
   // ------------------------------------------------------------
   // parent widget for the buttons
   QWidget* hButtonWidget = new QWidget( this );
   hButtonWidget->setObjectName( QString::fromUtf8( "hButtonWidget" ) );
   vLayout->addWidget( hButtonWidget );
   
   // ------------------------------------------------------------
   // options button box
   QHBoxLayout* hLayoutButtons = new QHBoxLayout( hButtonWidget );
   hLayoutButtons->setObjectName( QString::fromUtf8( "hLayoutButtons" ) );
   hLayoutButtons->setMargin(0);
   
   updateDefaultsButton = new QPushButton( QPixmap( ":/vk_icons/icons/filesave.png" ),
                                     "Save As Project Default" );
   hLayoutButtons->addWidget( updateDefaultsButton );
   hLayoutButtons->addStretch( 1 );
   
   optionsButtonBox = new QDialogButtonBox( hButtonWidget );
   optionsButtonBox->setObjectName( QString::fromUtf8( "optionsButtonBox" ) );
   optionsButtonBox->setOrientation( Qt::Horizontal );
   optionsButtonBox->setStandardButtons( QDialogButtonBox::Apply |
                                         QDialogButtonBox::Cancel |
                                         QDialogButtonBox::Ok );
   hLayoutButtons->addWidget( optionsButtonBox );
   
   // ------------------------------------------------------------
   // signals / slots
   connect( contentsListWidget, SIGNAL( itemSelectionChanged() ),
            this,                 SLOT( showPage() ) );

   QPushButton* applyButton  = optionsButtonBox->button( QDialogButtonBox::Apply );
   QPushButton* cancelButton = optionsButtonBox->button( QDialogButtonBox::Cancel );
   QPushButton* okButton     = optionsButtonBox->button( QDialogButtonBox::Ok );
   connect( applyButton,      SIGNAL( released() ), this, SLOT( apply()  ) ); // Apply
   connect( optionsButtonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); // Cancel
   connect( optionsButtonBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); // Ok
   connect( updateDefaultsButton, SIGNAL( released() ), this, SLOT( overwriteDefaultConfig() ) );

   // ------------------------------------------------------------
   // setup default state
   applyButton->setEnabled( false );
   cancelButton->setEnabled( true );
   okButton->setDefault( true );
}
Example #23
0
LTMSidebar::LTMSidebar(MainWindow *parent, const QDir &home) : QWidget(parent), home(home), main(parent), active(false)
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->setContentsMargins(0,0,0,0);
    mainLayout->setSpacing(0);
    setContentsMargins(0,0,0,0);

    seasonsWidget = new GcSplitterItem(tr("Date Ranges"), iconFromPNG(":images/sidebar/calendar.png"), this);
    QAction *moreSeasonAct = new QAction(iconFromPNG(":images/sidebar/extra.png"), tr("Menu"), this);
    seasonsWidget->addAction(moreSeasonAct);
    connect(moreSeasonAct, SIGNAL(triggered(void)), this, SLOT(dateRangePopup(void)));

    dateRangeTree = new SeasonTreeView;
    //allDateRanges = new QTreeWidgetItem(dateRangeTree, ROOT_TYPE);
    allDateRanges=dateRangeTree->invisibleRootItem();
    // Drop for Seasons
    allDateRanges->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
    allDateRanges->setText(0, tr("Date Ranges"));
    dateRangeTree->setFrameStyle(QFrame::NoFrame);
    dateRangeTree->setColumnCount(1);
    dateRangeTree->setSelectionMode(QAbstractItemView::SingleSelection);
    dateRangeTree->header()->hide();
    dateRangeTree->setIndentation(5);
    dateRangeTree->expandItem(allDateRanges);
    dateRangeTree->setContextMenuPolicy(Qt::CustomContextMenu);
#ifdef Q_OS_MAC
    dateRangeTree->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
    seasonsWidget->addWidget(dateRangeTree);


    eventsWidget = new GcSplitterItem(tr("Events"), iconFromPNG(":images/sidebar/bookmark.png"), this);
    QAction *moreEventAct = new QAction(iconFromPNG(":images/sidebar/extra.png"), tr("Menu"), this);
    eventsWidget->addAction(moreEventAct);
    connect(moreEventAct, SIGNAL(triggered(void)), this, SLOT(eventPopup(void)));


    eventTree = new QTreeWidget;
    eventTree->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    //allEvents = new QTreeWidgetItem(eventTree, ROOT_TYPE);
    allEvents = eventTree->invisibleRootItem();
    allEvents->setText(0, tr("Events"));
    eventTree->setFrameStyle(QFrame::NoFrame);
    eventTree->setColumnCount(2);
    eventTree->setSelectionMode(QAbstractItemView::SingleSelection);
    eventTree->header()->hide();
    eventTree->setIndentation(5);
    eventTree->expandItem(allEvents);
    eventTree->setContextMenuPolicy(Qt::CustomContextMenu);
    eventTree->horizontalScrollBar()->setDisabled(true);
    eventTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
#ifdef Q_OS_MAC
    eventTree->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
    eventsWidget->addWidget(eventTree);

    seasons = parent->seasons;
    resetSeasons(); // reset the season list

    configChanged(); // will reset the metric tree

    splitter = new GcSplitter(Qt::Vertical);
    splitter->addWidget(seasonsWidget);
    splitter->addWidget(eventsWidget);

    GcSplitterItem *summaryWidget = new GcSplitterItem(tr("Summary"), iconFromPNG(":images/sidebar/dashboard.png"), this);

    summary = new QWebView(this);
    summary->setContentsMargins(0,0,0,0);
    summary->page()->view()->setContentsMargins(0,0,0,0);
    summary->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
    summary->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    summary->setAcceptDrops(false);

    summaryWidget->addWidget(summary);

    QFont defaultFont; // mainwindow sets up the defaults.. we need to apply
    summary->settings()->setFontSize(QWebSettings::DefaultFontSize, defaultFont.pointSize());
    summary->settings()->setFontFamily(QWebSettings::StandardFont, defaultFont.family());
    splitter->addWidget(summaryWidget);

    mainLayout->addWidget(splitter);

    splitter->prepare(main->cyclist, "LTM");

    // our date ranges
    connect(dateRangeTree,SIGNAL(itemSelectionChanged()), this, SLOT(dateRangeTreeWidgetSelectionChanged()));
    connect(dateRangeTree,SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(dateRangePopup(const QPoint &)));
    connect(dateRangeTree,SIGNAL(itemChanged(QTreeWidgetItem *,int)), this, SLOT(dateRangeChanged(QTreeWidgetItem*, int)));
    connect(dateRangeTree,SIGNAL(itemMoved(QTreeWidgetItem *,int, int)), this, SLOT(dateRangeMoved(QTreeWidgetItem*, int, int)));
    connect(eventTree,SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(eventPopup(const QPoint &)));
    // GC signal
    connect(main, SIGNAL(configChanged()), this, SLOT(configChanged()));
    connect(seasons, SIGNAL(seasonsChanged()), this, SLOT(resetSeasons()));

    connect(this, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(setSummary(DateRange)));

    // let everyone know what date range we are starting with
    dateRangeTreeWidgetSelectionChanged();

}
Example #24
0
SubPubPage::SubPubPage(QWidget* parent) : QWidget(parent)
{
    titlePtr = new QLabel();
    
    msgCatagoryStrPtr = new QString("");
    specificMsgStrPtr = new QString("");
    
    msgCatagoryStrLstPtr = new QVector<QListWidgetItem*>();
    msgCatagoryStrLstPtr->push_back(new QListWidgetItem(QIcon(RosEnv::imagesInstallLoc + "msg2.png"),
                                                        "std_msgs") );
    msgCatagoryStrLstPtr->push_back(new QListWidgetItem(QIcon(RosEnv::imagesInstallLoc + "msg2.png"),
                                                        "sensor_msgs") );
    msgCatagoryStrLstPtr->push_back(new QListWidgetItem(QIcon(RosEnv::imagesInstallLoc + "msg2.png"),
                                                        "geometry_msgs") );

    typesEnteredStrLstPtr = new QVector<QListWidgetItem*>();
    
    // !!!Load this stuff from an xml res file!!!
    QVector<QListWidgetItem*>* std_msgsStrLstPtr = new QVector<QListWidgetItem*>();
    std_msgsStrLstPtr->push_back(new QListWidgetItem(QIcon(RosEnv::imagesInstallLoc + "data_type.png"),
                                                     "Char") );
    std_msgsStrLstPtr->push_back(new QListWidgetItem(QIcon(RosEnv::imagesInstallLoc + "data_type.png"),
                                                     "String") );
    
    QVector<QListWidgetItem*>* sensor_msgsStrLstPtr = new QVector<QListWidgetItem*>();
    sensor_msgsStrLstPtr->push_back(new QListWidgetItem(QIcon(RosEnv::imagesInstallLoc + "data_type.png"),
                                                        "Image") );
    sensor_msgsStrLstPtr->push_back(new QListWidgetItem(QIcon(RosEnv::imagesInstallLoc + "data_type.png"),
                                                        "PointCloud") );
    sensor_msgsStrLstPtr->push_back(new QListWidgetItem(QIcon(RosEnv::imagesInstallLoc + "data_type.png"),
                                                        "PointCloud2") );
    sensor_msgsStrLstPtr->push_back(new QListWidgetItem(QIcon(RosEnv::imagesInstallLoc + "data_type.png"),
                                                        "Imu") );
    
    QVector<QListWidgetItem*>* geometry_msgsStrLstPtr = new QVector<QListWidgetItem*>();
    geometry_msgsStrLstPtr->push_back(new QListWidgetItem(QIcon(RosEnv::imagesInstallLoc + "data_type.png"),
                                                        "vector2") );
    geometry_msgsStrLstPtr->push_back(new QListWidgetItem(QIcon(RosEnv::imagesInstallLoc + "data_type.png"),
                                                        "vector3") );

    specificMsgStrLstVec = new QVector<QVector<QListWidgetItem*>*>();
    specificMsgStrLstVec->push_back(std_msgsStrLstPtr);
    specificMsgStrLstVec->push_back(sensor_msgsStrLstPtr);
    specificMsgStrLstVec->push_back(geometry_msgsStrLstPtr);
    
    msgCatagoryLwPtr = new QListWidget();
    //msgCatagoryLwPtr->addItems(*msgCatagoryStrLstPtr);
    for(size_t i = 0; i < msgCatagoryStrLstPtr->size(); i++)
    {
        msgCatagoryLwPtr->addItem(new QListWidgetItem(*msgCatagoryStrLstPtr->at(i)) );
    }
    connect(msgCatagoryLwPtr, SIGNAL(itemSelectionChanged()), this, SLOT(handleSwapOptionsSlot()));
    specificMsgLwPtr = new QListWidget();
    //specificMsgLwPtr->addItems(*(specificMsgStrLstVec.at(0)) ); // default: first option
    for(size_t i = 0; i < specificMsgStrLstVec->at(0)->size(); i++)
    {
        specificMsgLwPtr->addItem(new QListWidgetItem(*specificMsgStrLstVec->at(0)->at(i)) );
    }
    
    addedLwPtr = new QListWidget();
    custBtnPtr = new QPushButton("Custom");
    addBtnPtr = new QPushButton("Add");
    removeBtnPtr = new QPushButton("Remove");
    
    btnLayout = new QHBoxLayout();
    btnLayout->addWidget(addBtnPtr);
    btnLayout->addWidget(removeBtnPtr);
    
    customMsgsGuiPtr = new CustomMsgsPage();
    
    outerLayoutPtr = new QGridLayout();
    outerLayoutPtr->addWidget(titlePtr, 0, 0, 1, 3, Qt::AlignHCenter);
    outerLayoutPtr->addWidget(msgCatagoryLwPtr, 1, 0);
    outerLayoutPtr->addWidget(custBtnPtr, 2, 0);
    outerLayoutPtr->addWidget(specificMsgLwPtr, 1, 1);
    outerLayoutPtr->addWidget(addedLwPtr, 1, 2);
    outerLayoutPtr->addLayout(btnLayout, 2, 2);
    
    connect(custBtnPtr, SIGNAL(released() ), this, SLOT(handleCustBtnPtrSlot() ) );
    connect(addBtnPtr, SIGNAL(released() ), this, SLOT(handleAddBtnPtrSlot() ) );
    connect(removeBtnPtr, SIGNAL(released() ), this, SLOT(handleRemoveBtnPtrSlot() ) );
    
    this->setLayout(outerLayoutPtr);
}
Example #25
0
VSTSettingsPage::VSTSettingsPage(VSTProcessor *processor_, QWidget *parent)
  : QWidget(parent), processor(processor_), addPluginDialog(this)
{
  int i;
  QString defaultSearchPath;

#if defined(Q_WS_MAC)
  defaultSearchPath = "~/Library/Audio/Plug-Ins/VST;/Library/Audio/Plug-Ins/VST";
#elif defined(Q_WS_WIN)
  if (sizeof(void*) == 4) {
    defaultSearchPath = QSettings("HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\VST",
                                  QSettings::NativeFormat).value("VSTPluginsPath").toString();
  }
  if (defaultSearchPath.isEmpty()) {
    defaultSearchPath = QSettings("HKEY_LOCAL_MACHINE\\Software\\VST",
                                  QSettings::NativeFormat).value("VSTPluginsPath").toString();
  }
#endif

  addPluginDialog.setSearchPath(settings->value("vst/searchPath", defaultSearchPath).toString());
  addPluginDialog.setPlugins(settings->value("vst/plugins").toStringList());

  QVBoxLayout *vBoxLayout = new QVBoxLayout;
  QHBoxLayout *hBoxLayout = new QHBoxLayout;

  pluginList = new QListWidget;
  connect(pluginList, SIGNAL(itemSelectionChanged()),
          this, SLOT(itemSelectionChanged()));
  for (i = 0; i < processor->numPlugins(); i++) {
    pluginList->addItem(processor->getPlugin(i)->getName());
  }
  hBoxLayout->addWidget(pluginList);

  QVBoxLayout *buttonLayout = new QVBoxLayout;
  QPushButton *addButton = new QPushButton(QIcon::fromTheme("list-add"), tr("Add"));
  connect(addButton, SIGNAL(clicked()),
          this, SLOT(addPlugin()));
  buttonLayout->addWidget(addButton);
  removeButton = new QPushButton(QIcon::fromTheme("list-remove"), tr("Remove"));
  connect(removeButton, SIGNAL(clicked()),
          this, SLOT(removePlugin()));
  buttonLayout->addWidget(removeButton);
  upButton = new QPushButton(QIcon::fromTheme("go-up"), tr("Up"));
  connect(upButton, SIGNAL(clicked()),
          this, SLOT(movePluginUp()));
  buttonLayout->addWidget(upButton);
  downButton = new QPushButton(QIcon::fromTheme("go-down"), tr("Down"));
  connect(downButton, SIGNAL(clicked()),
          this, SLOT(movePluginDown()));
  buttonLayout->addWidget(downButton);
  editButton = new QPushButton(tr("Edit..."));
  connect(editButton, SIGNAL(clicked()),
          this, SLOT(openEditor()));
  buttonLayout->addWidget(editButton);
  hBoxLayout->addLayout(buttonLayout);

  vBoxLayout->addLayout(hBoxLayout);

  setLayout(vBoxLayout);
  itemSelectionChanged();
}
Example #26
0
DatabaseMgr::DatabaseMgr(QWidget *parent) :
    QWidget(parent)
{
    QHBoxLayout *horiLayoutMain = new QHBoxLayout(this);
    horiLayoutMain->setContentsMargins(2, 2, 2, 2);

    JSplitter *splitter = new JSplitter(this);
    splitter->setHandleWidth(6);
    splitter->setHandleColor(QColor(100, 100, 100, 30));
    splitter->setScales(QList<double>() << 1 << 2);
    horiLayoutMain->addWidget(splitter);

    QWidget *widgetLeftArea = new QWidget(this);
    splitter->addWidget(widgetLeftArea);

    QVBoxLayout *vertLayoutLeft = new QVBoxLayout(widgetLeftArea);
    vertLayoutLeft->setSpacing(6);
    vertLayoutLeft->setContentsMargins(2, 2, 2, 2);

    // left

    q_toolBoxSignalTables = new QToolBox(widgetLeftArea);
    q_toolBoxSignalTables->layout()->setSpacing(3);
    vertLayoutLeft->addWidget(q_toolBoxSignalTables);

    q_listWidgetSignalTable = new QListWidget(q_toolBoxSignalTables);
    q_toolBoxSignalTables->addItem(q_listWidgetSignalTable, QStringLiteral("信号表名"));

    q_buttonReload = new QPushButton(QStringLiteral("重新加载数据库"), widgetLeftArea);
    q_buttonReload->setMinimumWidth(250);
    vertLayoutLeft->addWidget(q_buttonReload, 0, Qt::AlignRight);

    // right

    QWidget *widgetRightArea = new QWidget(this);
    splitter->addWidget(widgetRightArea);

    QVBoxLayout *vertLayoutRight = new QVBoxLayout(widgetRightArea);
    vertLayoutRight->setContentsMargins(2, 2, 2, 2);
    vertLayoutRight->setSpacing(6);

    q_tableSignalSiftBefore = new JFilterTableView(widgetRightArea);
    vertLayoutRight->addWidget(q_tableSignalSiftBefore);

    QHBoxLayout *horiLayoutBottom = new QHBoxLayout();
    vertLayoutRight->addLayout(horiLayoutBottom);

    //
    horiLayoutBottom->addWidget(new QLabel(QStringLiteral("注:上表中橘黄色行号的为选中状态")));

    horiLayoutBottom->addStretch();

    q_checkSelectAll = new QCheckBox(QStringLiteral("全选"), widgetRightArea);
    q_buttonRestore = new QPushButton(QStringLiteral("还原"), widgetRightArea);
    q_buttonSave = new QPushButton(QStringLiteral("更新到数据库"), widgetRightArea);
    q_buttonRestore->setMinimumWidth(200);
    q_buttonSave->setMinimumWidth(200);

    if (!GlobalConfig::instance()->canWriteDatabase()) {
        q_buttonSave->hide();
    }

    horiLayoutBottom->addWidget(q_checkSelectAll);
    horiLayoutBottom->addSpacing(10);
    horiLayoutBottom->addWidget(q_buttonRestore);
    horiLayoutBottom->addWidget(q_buttonSave);

    //
    connect(q_listWidgetSignalTable, &QListWidget::currentTextChanged, [=](const QString &text) {
        updateToolBoxItemText(0, QStringLiteral("信号表名"), text);
    });
    connect(q_buttonReload, &QPushButton::clicked, [=](){
        // 更新信号表列表
        updateSignalTable();
    });
    //
    connect(q_tableSignalSiftBefore->view(), SIGNAL(itemSelectionChanged()),
            SLOT(_emit_tableSignalSiftSelectChanged()));
    connect(q_checkSelectAll, &QPushButton::toggled, [=](bool checked){
        //
        signalSiftSelectAll(checked);
    });
    connect(q_buttonRestore, &QPushButton::clicked, [=](){
        //
        updateTableSignalSift();
    });
    connect(q_buttonSave, &QPushButton::clicked, [=](){
        //
        int result = QMessageBox::warning(this, QStringLiteral("筛选信号量"),
                                          QStringLiteral("数据库将被修改!是否继续?"),
                                          QStringLiteral("继续"), QStringLiteral("取消"));
        if (result == 1) {
            return; // 取消修改
        }
        //
        _emit_buttonSaveClicked();
    });

    //
    if (!GlobalConfig::instance()->canReadDatabase()) {
        q_buttonReload->hide();
        q_buttonRestore->hide();
    }
    if (!GlobalConfig::instance()->canWriteDatabase()) {
        q_buttonSave->hide();
    }
}
Example #27
0
AbstractConfig::AbstractConfig(AbstractContent * content, AbstractConfig_PARENT * parent)
    : AbstractConfig_TYPE(parent)
    , m_content(content)
    , m_commonUi(new Ui::AbstractConfig())
#if !defined(MOBILE_UI)
    , m_closeButton(0)
    , m_okButton(0)
#endif
    , m_frame(FrameFactory::defaultPanelFrame())
{
#if !defined(MOBILE_UI)
    // close button
    m_closeButton = new StyledButtonItem(tr(" x "), font(), this);//this, ":/data/button-close.png", ":/data/button-close-hovered.png", ":/data/button-close-pressed.png");
    connect(m_closeButton, SIGNAL(clicked()), this, SIGNAL(requestClose()));

    // WIDGET setup (populate contents and set base palette (only) to transparent)
    QWidget * widget = new QWidget();
    m_commonUi->setupUi(widget);
    QPalette pal;
    QColor oldColor = pal.window().color();
    pal.setBrush(QPalette::Window, Qt::transparent);
    widget->setPalette(pal);
    pal.setBrush(QPalette::Window, oldColor);
    m_commonUi->tab->setPalette(pal);
#else
    m_commonUi->setupUi(this);
#endif

    populateFrameList();

    // select the frame
    quint32 frameClass = m_content->frameClass();
    if (frameClass != Frame::NoFrame) {
        for (int i = 0; i < m_commonUi->framesList->count(); ++i) {
            QListWidgetItem * item = m_commonUi->framesList->item(i);
            if (item->data(Qt::UserRole).toUInt() == frameClass) {
                item->setSelected(true);
                break;
            }
        }
    }

    // read other properties
    m_commonUi->reflection->setChecked(m_content->mirrored());
    m_commonUi->contentLocked->setChecked(m_content->locked());
    m_commonUi->fixedPosition->setChecked(m_content->fixedPosition());
    m_commonUi->fixedRotation->setChecked(m_content->fixedRotation());
    m_commonUi->fixedPerspective->setChecked(m_content->fixedPerspective());

    connect(m_commonUi->front, SIGNAL(clicked()), m_content, SLOT(slotStackFront()));
    connect(m_commonUi->raise, SIGNAL(clicked()), m_content, SLOT(slotStackRaise()));
    connect(m_commonUi->lower, SIGNAL(clicked()), m_content, SLOT(slotStackLower()));
    connect(m_commonUi->back, SIGNAL(clicked()), m_content, SLOT(slotStackBack()));
    connect(m_commonUi->save, SIGNAL(clicked()), m_content, SLOT(slotSaveAs()));
    connect(m_commonUi->background, SIGNAL(clicked()), m_content, SIGNAL(requestBackgrounding()));
    connect(m_commonUi->del, SIGNAL(clicked()), m_content, SIGNAL(requestRemoval()));

    connect(m_commonUi->contentLocked, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetLocked(int)));
    connect(m_commonUi->fixedPosition, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedPosition(int)));
    connect(m_commonUi->fixedRotation, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedRotation(int)));
    connect(m_commonUi->fixedPerspective, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedPerspective(int)));

    connect(m_commonUi->newFrame, SIGNAL(clicked()), this, SLOT(slotAddFrame()));
    connect(m_commonUi->removeFrame, SIGNAL(clicked()), this, SLOT(slotRemoveFrame()));
    connect(m_commonUi->lookApplyAll, SIGNAL(clicked()), this, SLOT(slotLookApplyAll()));
    connect(m_commonUi->framesList, SIGNAL(itemSelectionChanged()), this, SLOT(slotFrameSelectionChanged()));
    connect(m_commonUi->reflection, SIGNAL(toggled(bool)), this, SLOT(slotReflectionToggled(bool)));

    // ITEM setup
#if !defined(MOBILE_UI)
    setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
    setWidget(widget);
    static qreal s_propZBase = 99999;
    setZValue(s_propZBase++);
#endif

#if !defined(MOBILE_UI) && QT_VERSION >= 0x040600
    // fade in animation
    QPropertyAnimation * ani = new QPropertyAnimation(this, "opacity");
    ani->setEasingCurve(QEasingCurve::OutCubic);
    ani->setDuration(400);
    ani->setStartValue(0.0);
    ani->setEndValue(1.0);
    ani->start(QPropertyAnimation::DeleteWhenStopped);
#endif
}
	Q_ASSERT(ok);

	// Single/double click item activation is style dependend
	if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) == 0) 
	{
		ok = connect(this, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(slotExecuted(QTreeWidgetItem*)));
		Q_ASSERT(ok);
	}
 	
	ok = connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(contextMenu(const QPoint&)));
	Q_ASSERT(ok);

	ok = connect(&m_autoOpenTimer, SIGNAL(timeout()), this, SLOT(autoOpenTimeout()));
	Q_ASSERT(ok);

	ok = connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(slotModifySelection()));
	Q_ASSERT(ok);
}

void CBookshelfIndex::slotModifySelection()
{
	// This creates recursion if a folder is selected, but not infinite.
	//qDebug("CBookshelfIndex::slotModifySelection");
	QList<QTreeWidgetItem*> selection = selectedItems();
	foreach (QTreeWidgetItem* item, selection) {
		BTIndexFolder* folder = dynamic_cast<BTIndexFolder*>(item);
		if (folder) {
			item->setSelected(false);
			break;
		}
	}
Example #29
0
Athlete::Athlete(Context *context, const QDir &home)
{
    // athlete name
    this->home = home;
    this->context = context;
    context->athlete = this;
    cyclist = home.dirName();
    isclean = false;

    // Recovering from a crash?
    if(!appsettings->cvalue(cyclist, GC_SAFEEXIT, true).toBool()) {
        GcCrashDialog *crashed = new GcCrashDialog(home);
        crashed->exec();
    }
    appsettings->setCValue(cyclist, GC_SAFEEXIT, false); // will be set to true on exit

    // Before we initialise we need to run the upgrade wizard for this athlete
    GcUpgrade v3;
    v3.upgrade(context->athlete->home);

    // metric / non-metric
    QVariant unit = appsettings->cvalue(cyclist, GC_UNIT);
    if (unit == 0) {
        // Default to system locale
        unit = appsettings->value(this, GC_UNIT,
             QLocale::system().measurementSystem() == QLocale::MetricSystem ? GC_UNIT_METRIC : GC_UNIT_IMPERIAL);
        appsettings->setCValue(cyclist, GC_UNIT, unit);
    }
    useMetricUnits = (unit.toString() == GC_UNIT_METRIC);

    // Power Zones
    zones_ = new Zones;
    QFile zonesFile(home.absolutePath() + "/power.zones");
    if (zonesFile.exists()) {
        if (!zones_->read(zonesFile)) {
            QMessageBox::critical(context->mainWindow, tr("Zones File Error"),
				  zones_->errorString());
        } else if (! zones_->warningString().isEmpty())
            QMessageBox::warning(context->mainWindow, tr("Reading Zones File"), zones_->warningString());
    }

    // Heartrate Zones
    hrzones_ = new HrZones;
    QFile hrzonesFile(home.absolutePath() + "/hr.zones");
    if (hrzonesFile.exists()) {
        if (!hrzones_->read(hrzonesFile)) {
            QMessageBox::critical(context->mainWindow, tr("HR Zones File Error"),
				  hrzones_->errorString());
        } else if (! hrzones_->warningString().isEmpty())
            QMessageBox::warning(context->mainWindow, tr("Reading HR Zones File"), hrzones_->warningString());
    }

    // read athlete's charts.xml and translate etc
    LTMSettings reader;
    reader.readChartXML(context->athlete->home, presets);
    translateDefaultCharts(presets);

    // Metadata
    rideMetadata_ = new RideMetadata(context,true);
    rideMetadata_->hide();

    // Date Ranges
    seasons = new Seasons(home);

    // Search / filter
#ifdef GC_HAVE_LUCENE
    namedSearches = new NamedSearches(this); // must be before navigator
    lucene = new Lucene(context, context); // before metricDB attempts to refresh
#endif

    // metrics DB
    metricDB = new MetricAggregator(context); // just to catch config updates!
    metricDB->refreshMetrics();

    // the model atop the metric DB
    sqlModel = new QSqlTableModel(this, metricDB->db()->connection());
    sqlModel->setTable("metrics");
    sqlModel->setEditStrategy(QSqlTableModel::OnManualSubmit);

    // Downloaders
    withingsDownload = new WithingsDownload(context);
    zeoDownload      = new ZeoDownload(context);
    calendarDownload = new CalendarDownload(context);

    // Calendar
#ifdef GC_HAVE_ICAL
    rideCalendar = new ICalendar(context); // my local/remote calendar entries
    davCalendar = new CalDAV(context); // remote caldav
    davCalendar->download(); // refresh the diary window
#endif

    // RIDE TREE -- transitionary
    treeWidget = new QTreeWidget;
    treeWidget->setColumnCount(3);
    treeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
    treeWidget->header()->resizeSection(0,60);
    treeWidget->header()->resizeSection(1,100);
    treeWidget->header()->resizeSection(2,70);
    treeWidget->header()->hide();
    treeWidget->setAlternatingRowColors (false);
    treeWidget->setIndentation(5);
    treeWidget->hide();

    allRides = new QTreeWidgetItem(context->athlete->treeWidget, FOLDER_TYPE);
    allRides->setText(0, tr("All Activities"));
    treeWidget->expandItem(context->athlete->allRides);
    treeWidget->setFirstItemColumnSpanned (context->athlete->allRides, true);

    //.INTERVALS TREE -- transitionary
    intervalWidget = new IntervalTreeView(context);
    intervalWidget->setColumnCount(1);
    intervalWidget->setIndentation(5);
    intervalWidget->setSortingEnabled(false);
    intervalWidget->header()->hide();
    intervalWidget->setAlternatingRowColors (false);
    intervalWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
    intervalWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
    intervalWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
    intervalWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    intervalWidget->setFrameStyle(QFrame::NoFrame);
    allIntervals = context->athlete->intervalWidget->invisibleRootItem();
    allIntervals->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
    allIntervals->setText(0, tr("Intervals"));

    // populate ride list
    QTreeWidgetItem *last = NULL;
    QStringListIterator i(RideFileFactory::instance().listRideFiles(home));
    while (i.hasNext()) {
        QString name = i.next();
        QDateTime dt;
        if (RideFile::parseRideFileName(name, &dt)) {
            last = new RideItem(RIDE_TYPE, home.path(), name, dt, zones(), hrZones(), context);
            allRides->addChild(last);
        }
    }

    // trap signals
    connect(context, SIGNAL(configChanged()), this, SLOT(configChanged()));
    connect(treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(rideTreeWidgetSelectionChanged()));
    connect(context,SIGNAL(rideAdded(RideItem*)),this,SLOT(checkCPX(RideItem*)));
    connect(context,SIGNAL(rideDeleted(RideItem*)),this,SLOT(checkCPX(RideItem*)));
    connect(intervalWidget,SIGNAL(itemSelectionChanged()), this, SLOT(intervalTreeWidgetSelectionChanged()));
    connect(intervalWidget,SIGNAL(itemChanged(QTreeWidgetItem *,int)), this, SLOT(updateRideFileIntervals()));
}
VolumeListingDialog::VolumeListingDialog(QWidget* parent) 
    : QWidget(parent)
    , reader_(0)
{
    setWindowFlags(Qt::Dialog);
    setWindowModality(Qt::WindowModal);
    setWindowTitle(tr("Volume Selection"));

    // table configuration
    table_ = new QTableWidget();
    table_->setSelectionBehavior(QAbstractItemView::SelectRows);
    table_->setSortingEnabled(true);
    table_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    // top label
    QVBoxLayout* mainLayout = new QVBoxLayout();
    titleLabel_ = new QLabel(tr("The selected file contains multiple volumes. Please select the volumes to load:"));
    QFont labelFont = titleLabel_->font();
    labelFont.setPointSize(titleLabel_->font().pointSize()+1);
    labelFont.setBold(true);
    titleLabel_->setFont(labelFont);
    mainLayout->addWidget(titleLabel_);
    
    // filter bar
    QHBoxLayout* searchLayout = new QHBoxLayout();
    filterLabel_ = new QLabel(tr("Filter: "));
    searchLayout->addWidget(filterLabel_);
    filterTextBox_ = new QLineEdit();
    searchLayout->addWidget(filterTextBox_);
    comboBoxFilterAttribute_ = new QComboBox();
    comboBoxFilterAttribute_->setMinimumWidth(100);
    searchLayout->addWidget(comboBoxFilterAttribute_);
    mainLayout->addLayout(searchLayout);

    // table
    mainLayout->addWidget(table_);

    // buttons
    QHBoxLayout* buttonLayout = new QHBoxLayout();
    buttonLayout->addStretch();
    cancelButton_ = new QPushButton(tr("Cancel"));
    cancelButton_->setFixedWidth(100);
    buttonLayout->addWidget(cancelButton_);
    selectAllButton_ = new QPushButton(tr("Select All"));
    selectAllButton_->setFixedWidth(100);
    buttonLayout->addWidget(selectAllButton_);
    loadButton_ = new QPushButton(tr("Load"));
    loadButton_->setFixedWidth(100);
    QFont loadFont(loadButton_->font());
    loadFont.setBold(true);
    loadButton_->setFont(loadFont);
    buttonLayout->addWidget(loadButton_);
    mainLayout->addLayout(buttonLayout);

    setLayout(mainLayout);

    connect(table_, SIGNAL(itemSelectionChanged()), this, SLOT(updateGuiState()));
    connect(table_, SIGNAL(cellDoubleClicked(int, int)), this, SLOT(cellDoubleClicked()));

    connect(filterTextBox_, SIGNAL(textChanged(const QString&)), this, SLOT(updateTableRows()));
    connect(filterTextBox_, SIGNAL(editingFinished()), this, SLOT(updateTableRows()));
    connect(comboBoxFilterAttribute_, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTableRows()));

    connect(loadButton_, SIGNAL(clicked()), this, SLOT(loadClicked()));
    connect(selectAllButton_, SIGNAL(clicked()), this, SLOT(selectAllClicked()));
    connect(cancelButton_, SIGNAL(clicked()), this, SLOT(cancelClicked()));

    resize(600, 300);
    updateGuiState();
}