Ejemplo n.º 1
0
BanFrame::BanFrame(QWidget *parent, const char *name, bool banEnabled)
:QFrame(parent)
{
	setFrameStyle(QFrame::Panel | QFrame::Raised);
	setObjectName(name);

	QGridLayout *g = new QGridLayout(this);

	m_pEnable = new QCheckBox(__tr2qs("Enable URL ban list"),this);
	connect(m_pEnable,SIGNAL(clicked()),this,SLOT(enableClicked()));
	m_pEnable->setChecked(banEnabled);
	g->addWidget(m_pEnable,0,0,1,2);

	m_pBanList = new QListWidget(this);
	m_pBanList->setMinimumHeight(100);
	loadBanList();
	for(QString *tmp=g_pBanList->first();tmp;tmp=g_pBanList->next()) {
		m_pBanList->addItem(*tmp); // load ban list into listbox
	}

	m_pBanList->setEnabled(m_pEnable->isChecked());
	g->addWidget(m_pBanList,1,0,1,2);

	m_pAddBtn = new QPushButton(__tr2qs("&Add Ban"),this);
	m_pAddBtn->setObjectName("add");
	connect(m_pAddBtn,SIGNAL(clicked()),this,SLOT(addBan()));
	m_pAddBtn->setEnabled(m_pEnable->isChecked());
	g->addWidget(m_pAddBtn,2,0);

	m_pRemoveBtn = new QPushButton(__tr2qs("&Remove Selected"),this);
	m_pRemoveBtn->setObjectName("remove");
	connect(m_pRemoveBtn,SIGNAL(clicked()),this,SLOT(removeBan()));
	m_pRemoveBtn->setEnabled(m_pEnable->isChecked());
	g->addWidget(m_pRemoveBtn,2,1);
}
ossimQtBrightnessContrastDialog::ossimQtBrightnessContrastDialog(
   QWidget* parent,
   const char* name,
   bool modal,
   Qt::WFlags f)
   : QDialog(parent, name, modal, f),
     ossimConnectableObjectListener(),
     theParent(parent),
     theFilter(NULL),
     theMainVBox(NULL),

     theHBox1(NULL),
     theBrightnessLabel(NULL),
     theBrightnessSlider(NULL),
     theBrightnessValueLabel(NULL),
     
     theHBox2(NULL),
     theContrastLabel(NULL),
     theContrastSlider(NULL),
     theContrastValueLabel(NULL),

     theHBox3(NULL),
     theEnableCheckBox(NULL),
     theResetButton(NULL),
     theCloseButton(NULL)
{
   setCaption("Brightness Contrast Property Editor");
   
   // Main vertical box.
   theMainVBox = new Q3VBoxLayout(this);

   // First row, for the brightness slider.
   theHBox1 = new Q3HBoxLayout(theMainVBox);

   // Brightness label.
   theBrightnessLabel = new QLabel( this, "theBrightnessLabel" );
   theBrightnessLabel->setMinimumSize( QSize( 90, 0 ) );
   theBrightnessLabel->setAlignment( int( Qt::AlignVCenter | Qt::AlignLeft ) );
   theBrightnessLabel->setText("brightness: ");
   theHBox1->addWidget( theBrightnessLabel );

   // Brightness slider.
   theBrightnessSlider = new QSlider( this, "theBrightnessSlider" );
   theBrightnessSlider->setMinimumSize( QSize( 290, 0 ) );
   theBrightnessSlider->setMaxValue( 400 );
   theBrightnessSlider->setPageStep( 1 );
   theBrightnessSlider->setValue( 400 );
   theBrightnessSlider->setTracking( FALSE );
   theBrightnessSlider->setOrientation( Qt::Horizontal );
   theBrightnessSlider->setTickmarks( QSlider::TicksRight );
   theBrightnessSlider->setTickInterval( 40 );
   theHBox1->addWidget( theBrightnessSlider );

   // Brightness value
   theBrightnessValueLabel = new QLabel( this, "theBrightnessValueLabel" );
   theBrightnessValueLabel->setMinimumSize( QSize( 40, 0 ) );
   theBrightnessValueLabel->setText("0.0");
   theHBox1->addWidget( theBrightnessValueLabel );

   // Second row, for the contrast slider.
   theHBox2 = new Q3HBoxLayout(theMainVBox);

   // Contrast label.
   theContrastLabel = new QLabel( this, "theContrastLabel" );
   theContrastLabel->setMinimumSize( QSize( 90, 0 ) );
   theContrastLabel->setAlignment( int( Qt::AlignVCenter | Qt::AlignLeft ) );
   theContrastLabel->setText("contrast: ");
   theHBox2->addWidget( theContrastLabel );

   // Contrast slider.
   theContrastSlider = new QSlider( this, "theContrastSlider" );
   theContrastSlider->setMinimumSize( QSize( 290, 0 ) );
   theContrastSlider->setMaxValue( 400 );
   theContrastSlider->setPageStep( 1 );
   theContrastSlider->setValue( 400 );
   theContrastSlider->setTracking( FALSE );
   theContrastSlider->setOrientation( Qt::Horizontal );
   theContrastSlider->setTickmarks( QSlider::TicksRight );
   theContrastSlider->setTickInterval( 40 );
   theHBox2->addWidget( theContrastSlider );

   // Contrast value
   theContrastValueLabel = new QLabel( this, "theContrastValueLabel" );
   theContrastValueLabel->setMinimumSize( QSize( 40, 0 ) );
   theContrastValueLabel->setText("0.0");
   theHBox2->addWidget( theContrastValueLabel );

   // Let's put a line in between things...
   Q3Frame* line1 = new Q3Frame( this, "line1" );
   line1->setFrameShape( Q3Frame::HLine );
   line1->setFrameShadow( Q3Frame::Sunken );
   theMainVBox->addWidget( line1 );
   
   // Third row, filter enable disable check box and close.
   theHBox3 = new Q3HBoxLayout(theMainVBox);
   
   // Make the check box.
   theEnableCheckBox = new  QCheckBox(this, "theEnableButton");
   theEnableCheckBox->setText("enable");
   theHBox3->addWidget(theEnableCheckBox);

   // Make the reset button...
   theResetButton = new QPushButton( this, "theResetButton" );
   theResetButton->setText( "Reset" );
   theResetButton->setDefault(false);
   theResetButton->setAutoDefault(false);
   theHBox3->addWidget(theResetButton);

   theCloseButton = new QPushButton( this, "theCloseButton" );
   theCloseButton->setText( "Close" );
   theCloseButton->setDefault(false);
   theCloseButton->setAutoDefault(false);   
   theHBox3->addWidget(theCloseButton);

   //---
   // Connect all the signals to slots...
   //
   // NOTE:
   // If a push button is set to "default" or "auto default" it will always
   // call that slot when return is pressed in the dialog.
   // Since this isn't what I want, all defaults are set to off!
   //---

   connect( theBrightnessSlider,
            SIGNAL( valueChanged(int) ),
            this,
            SLOT( brightnessSliderChanged(int) ) );
   
   connect( theContrastSlider,
            SIGNAL( valueChanged(int) ),
            this,
            SLOT( contrastSliderChanged(int) ) );
   
   connect( theEnableCheckBox, SIGNAL ( clicked() ),
            this, SLOT ( enableClicked() ) );
   
   connect( theResetButton, SIGNAL ( clicked() ),
            this, SLOT ( resetClicked() ) );
   
   connect( theCloseButton, SIGNAL ( clicked() ),
            this, SLOT ( closeClicked() ) );
}