Пример #1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void AboutDialog::addStringPairToVerInfoLayout(const QString& labelStr, const QString& infoStr, QGridLayout* verInfoLayout, int insertRow)
{
    QLabel* label = new QLabel(this);
    label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    label->setText(labelStr);
    verInfoLayout->addWidget(label, insertRow, 0);

    QLabel* info = new QLabel(this);
    info->setText(infoStr);
    verInfoLayout->addWidget(info, insertRow, 1 );

}
Пример #2
0
//! [4]
QLabel *IconPreviewArea::createPixmapLabel()
{
    QLabel *label = new QLabel;
    label->setEnabled(false);
    label->setAlignment(Qt::AlignCenter);
    label->setFrameShape(QFrame::Box);
    label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    label->setBackgroundRole(QPalette::Base);
    label->setAutoFillBackground(true);
    label->setMinimumSize(132, 132);
    return label;
}
Пример #3
0
LongMessageWidget::LongMessageWidget( QWidget *anchor, const QString &message,
                                     Amarok::Logger::MessageType type )
        : PopupWidget( anchor )
        , m_counter( 0 )
        , m_timeout( 6000 )
{
    DEBUG_BLOCK
    Q_UNUSED( type )

    setFrameStyle( QFrame::StyledPanel | QFrame::Raised );

    setContentsMargins( 4, 4, 4, 4 );

    setMinimumWidth( 26 );
    setMinimumHeight( 26 );
    setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );

    QPalette p = QToolTip::palette();
    setPalette( p );

    KHBox *hbox = new KHBox( this );
    layout()->addWidget( hbox );

    hbox->setSpacing( 12 );

    m_countdownFrame = new CountdownFrame( hbox );
    m_countdownFrame->setObjectName( "counterVisual" );
    m_countdownFrame->setFixedWidth( fontMetrics().width( "X" ) );
    m_countdownFrame->setFrameStyle( QFrame::Plain | QFrame::Box );
    QPalette pal;
    pal.setColor( m_countdownFrame->foregroundRole(), p.dark().color() );
    m_countdownFrame->setPalette( pal );

    QLabel *alabel = new QLabel( message, hbox );
    alabel->setWordWrap( true );
    alabel->setOpenExternalLinks( true );
    alabel->setObjectName( "label" );
    alabel->setTextFormat( Qt::RichText );
    alabel->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
    alabel->setPalette( p );

    hbox = new KHBox( this );
    layout()->addWidget( hbox );

    KPushButton *button = new KPushButton( KStandardGuiItem::close(), hbox );
    button->setObjectName( "closeButton" );
    connect( button, SIGNAL( clicked() ), SLOT( close() ) );

    reposition();

    show();
    m_timerId = startTimer( m_timeout / m_countdownFrame->height() );
}
Пример #4
0
// Create new label widget
QtWidgetObject* AtenTreeGuiDialog::addLabel(TreeGuiWidget* widget, QString text)
{
	QtWidgetObject* qtwo = widgetObjects_.add();
	QLabel *label = new QLabel(this);
	qtwo->set(widget, label, text);
	label->setText(text);
	label->setEnabled(widget->enabled());
	label->setVisible(widget->visible());
	label->setMinimumHeight(WIDGETHEIGHT);
	label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
	return qtwo;
}
Пример #5
0
void TlenAddAccountWidget::createGui()
{
	QVBoxLayout *mainLayout = new QVBoxLayout(this);

	QWidget *formWidget = new QWidget(this);
	mainLayout->addWidget(formWidget);

	QFormLayout *layout = new QFormLayout(formWidget);

	AccountId = new QLineEdit(this);
	//AccountId->setValidator(new LongValidator(1, 3999999999U, this));
	connect(AccountId, SIGNAL(textChanged(QString)), this, SLOT(dataChanged()));
	layout->addRow(tr("Tlen.pl login") + ':', AccountId);

	AccountPassword = new QLineEdit(this);
	connect(AccountPassword, SIGNAL(textChanged(QString)), this, SLOT(dataChanged()));
	AccountPassword->setEchoMode(QLineEdit::Password);
	layout->addRow(tr("Password") + ':', AccountPassword);

	RememberPassword = new QCheckBox(tr("Remember password"), this);
	RememberPassword->setChecked(true);
	layout->addRow(0, RememberPassword);

// 	RemindPassword = new QLabel(QString("<a href='remind'>%1</a>").arg(tr("Forgot Your Password?")));
// 	RemindPassword->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByMouse);
// 	layout->addRow(0, RemindPassword);
// 	connect(RemindPassword, SIGNAL(linkActivated(QString)), this, SLOT(remindPasssword()));

	Identity = new IdentitiesComboBox(true, this);
	connect(Identity, SIGNAL(identityChanged(Identity)), this, SLOT(dataChanged()));
	layout->addRow(tr("Account identity") + ':', Identity);

	QLabel *infoLabel = new QLabel(tr("<font size='-1'><i>Select or enter the identity that will be associated with this account.</i></font>"), this);
	infoLabel->setWordWrap(true);
	infoLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
	infoLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
	layout->addRow(0, infoLabel);
	mainLayout->addStretch(100);

	QDialogButtonBox *buttons = new QDialogButtonBox(Qt::Horizontal, this);
	mainLayout->addWidget(buttons);

	AddAccountButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogApplyButton), tr("Add Account"), this);
	QPushButton *cancelButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this);

	buttons->addButton(AddAccountButton, QDialogButtonBox::AcceptRole);
	buttons->addButton(cancelButton, QDialogButtonBox::DestructiveRole);

	connect(AddAccountButton, SIGNAL(clicked(bool)), this, SLOT(addAccountButtonClicked()));
	connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancelButtonClicked()));

	dataChanged();
}
Пример #6
0
ControllerView::ControllerView( Controller * _model, QWidget * _parent ) :
	QFrame( _parent ),
	ModelView( _model, this ),
	m_subWindow( NULL ),
	m_controllerDlg( NULL ),
	m_show( true )
{
	this->setFrameStyle( QFrame::StyledPanel );
	this->setFrameShadow( QFrame::Raised );

	QVBoxLayout *vBoxLayout = new QVBoxLayout(this);

	QHBoxLayout *hBox = new QHBoxLayout();
	vBoxLayout->addLayout(hBox);

	QLabel *label = new QLabel( "<b>" + _model->displayName() + "</b>", this);
	QSizePolicy sizePolicy = label->sizePolicy();
	sizePolicy.setHorizontalStretch(1);
	label->setSizePolicy(sizePolicy);

	hBox->addWidget(label);

	QPushButton * controlsButton = new QPushButton( tr( "Controls" ), this );
	connect( controlsButton, SIGNAL( clicked() ), SLOT( editControls() ) );

	hBox->addWidget(controlsButton);

	m_nameLabel = new QLabel(_model->name(), this);
	vBoxLayout->addWidget(m_nameLabel);


	m_controllerDlg = getController()->createDialog( gui->mainWindow()->workspace() );

	m_subWindow = gui->mainWindow()->addWindowedWidget( m_controllerDlg );
	
	Qt::WindowFlags flags = m_subWindow->windowFlags();
	flags &= ~Qt::WindowMaximizeButtonHint;
	m_subWindow->setWindowFlags( flags );
	m_subWindow->setFixedSize( m_subWindow->size() );

	m_subWindow->setWindowIcon( m_controllerDlg->windowIcon() );

	connect( m_controllerDlg, SIGNAL( closed() ),
		this, SLOT( closeControls() ) );

	m_subWindow->hide();

	setWhatsThis( tr( "Controllers are able to automate the value of a knob, "
				"slider, and other controls."  ) );

	setModel( _model );
}
Пример #7
0
AccountListWidget::AccountListWidget( AccountModelFactoryProxy* model, QWidget* parent )
    : QWidget( parent )
    , m_model( model )
{
    QVBoxLayout* mainLayout = new QVBoxLayout( this );
    TomahawkUtils::unmarginLayout( mainLayout );
    m_layout = new QVBoxLayout;
    TomahawkUtils::unmarginLayout( m_layout );
    mainLayout->addLayout( m_layout );
    mainLayout->setSpacing( 8 );

    connect( m_model, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ),
             this, SLOT( updateEntries( QModelIndex, QModelIndex ) ) );
    connect( m_model, SIGNAL( rowsInserted ( QModelIndex, int, int ) ),
             this, SLOT( insertEntries( QModelIndex, int, int ) ) );
    connect( m_model, SIGNAL( rowsRemoved( QModelIndex, int, int ) ),
             this, SLOT( removeEntries( QModelIndex, int, int ) ) );
    connect( m_model, SIGNAL( modelReset() ),
             this, SLOT( loadAllEntries() ) );

    connect( m_model, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ),
             this, SLOT( updateToggleOnlineStateButton() ) );

    QWidget* separatorLine = new QWidget( this );
    separatorLine->setFixedHeight( 1 );
    separatorLine->setContentsMargins( 0, 0, 0, 0 );
    separatorLine->setStyleSheet( "QWidget { border-top: 1px solid " +
                                  TomahawkStyle::BORDER_LINE.name() + "; }" ); //from ProxyStyle
    mainLayout->insertWidget( 0, separatorLine );
    mainLayout->addSpacing( 6 );

    QLabel *connectionsLabel = new QLabel( tr( "Connections" ).toUpper(), this );
    QFont clFont = connectionsLabel->font();
    clFont.setBold( true );
    connectionsLabel->setStyleSheet( "color: " + TomahawkStyle::GROUP_HEADER.name() );
    clFont.setPointSize( TomahawkUtils::defaultFontSize() + 1 );
    connectionsLabel->setFont( clFont );
    connectionsLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );

    m_toggleOnlineButton = new QPushButton( tr( "Connect &All" ), this );
    m_toggleOnlineButtonState = false;
    connect( m_toggleOnlineButton, SIGNAL( clicked() ),
             this, SLOT( toggleOnlineStateForAll() ) );

    QHBoxLayout *headerLayout = new QHBoxLayout( this );
    headerLayout->addWidget( connectionsLabel );
    headerLayout->addSpacing( 30 );
    headerLayout->addWidget( m_toggleOnlineButton );
    mainLayout->insertLayout( 0, headerLayout );

    updateToggleOnlineStateButton();
}
Пример #8
0
QGraphicsProxyWidget *
UpcomingEventsWidget::createLabel( const QString &text, QSizePolicy::Policy hPolicy )
{
    QLabel *label = new QLabel;
    label->setAttribute( Qt::WA_NoSystemBackground );
    label->setMinimumWidth( 10 );
    label->setSizePolicy( hPolicy, QSizePolicy::Preferred );
    label->setText( text );
    label->setWordWrap( false );
    QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget( this );
    proxy->setWidget( label );
    return proxy;
}
Пример #9
0
GotoTimeDialog::GotoTimeDialog( QWidget *parent, intf_thread_t *_p_intf)
               : QVLCDialog( parent, _p_intf )
{
    setWindowFlags( Qt::Tool );
    setWindowTitle( qtr( "Go to Time" ) );
    setWindowRole( "vlc-goto-time" );

    QGridLayout *mainLayout = new QGridLayout( this );
    mainLayout->setSizeConstraint( QLayout::SetFixedSize );

    QPushButton *gotoButton = new QPushButton( qtr( "&Go" ) );
    QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ) );
    QDialogButtonBox *buttonBox = new QDialogButtonBox;

    gotoButton->setDefault( true );
    buttonBox->addButton( gotoButton, QDialogButtonBox::AcceptRole );
    buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );

    QGroupBox *timeGroupBox = new QGroupBox;
    QGridLayout *boxLayout = new QGridLayout( timeGroupBox );

    QLabel *timeIntro = new QLabel( qtr( "Go to time" ) + ":" );
    timeIntro->setWordWrap( true );
    timeIntro->setAlignment( Qt::AlignCenter );

    timeEdit = new QTimeEdit();
    timeEdit->setDisplayFormat( "hh : mm : ss" );
    timeEdit->setAlignment( Qt::AlignRight );
    timeEdit->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );

    QLabel *helpFormat = new QLabel( timeEdit->displayFormat() );
    helpFormat->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred );

    QSpacerItem *spacerBox = new QSpacerItem( 20, 10, QSizePolicy::Minimum,
                                        QSizePolicy::Fixed );

    QSpacerItem *spacerItem = new QSpacerItem( 20, 3, QSizePolicy::Minimum,
                                        QSizePolicy::Expanding );

    boxLayout->addWidget( timeIntro, 0, 0, 1, 2 );
    boxLayout->addItem( spacerBox, 1, 0, 1, 2 );
    boxLayout->addWidget( timeEdit, 2, 0, 1, 1 );
    boxLayout->addWidget( helpFormat, 2, 1, 1, 1 );

    mainLayout->addWidget( timeGroupBox, 0, 0, 1, 4 );
    mainLayout->addItem( spacerItem, 1, 0 );
    mainLayout->addWidget( buttonBox, 2, 3 );

    BUTTONACT( gotoButton, close() );
    BUTTONACT( cancelButton, cancel() );
}
Пример #10
0
OptionsDialog::OptionsDialog( const QString& databaseFile, const QString& selectedEncoding, QWidget* parent )
 : KDialogBase( 
	KDialogBase::Plain, 
	i18n( "Advanced Import Options" ),
	Ok|Cancel, 
	Ok,
	parent, 
	"KexiMigration::OptionsDialog", 
	true, 
	false
 )
{
	setIcon(DesktopIcon("configure"));
	QGridLayout *lyr = new QGridLayout( plainPage(), 4, 3, KDialogBase::marginHint(), 
		KDialogBase::spacingHint());

	m_encodingComboBox = new KexiCharacterEncodingComboBox(plainPage(), selectedEncoding);
	m_encodingComboBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
	lyr->addWidget( m_encodingComboBox, 1, 1 );
	QLabel* lbl = new QLabel( 
		i18n("<h3>Text encoding for Microsoft Access database</h3>\n"
		"<p>Database file \"%1\" appears to be created by a version of Microsoft Access older than 2000.</p>"
		"<p>In order to properly import national characters, you may need to choose a proper text encoding "
		"if the database was created on a computer with a different character set.</p>")
		.arg(QDir::convertSeparators(databaseFile)), plainPage());
	lbl->setAlignment( Qt::AlignAuto | Qt::WordBreak );
	lbl->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
	lyr->addMultiCellWidget( lbl, 0, 0, 0, 2 );

	QLabel* lbl2 = new QLabel( m_encodingComboBox, i18n("Text encoding:"), plainPage());
	lyr->addWidget( lbl2, 1, 0 );

	m_chkAlwaysUseThisEncoding = new QCheckBox(
		i18n("Always use this encoding in similar situations"), plainPage());
	lyr->addMultiCellWidget( m_chkAlwaysUseThisEncoding, 2, 2, 1,2 );

	lyr->addItem( new QSpacerItem( 20, 111, QSizePolicy::Minimum, QSizePolicy::Expanding ), 3, 1 );
	lyr->addItem( new QSpacerItem( 121, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 2 );

	//read config
	kapp->config()->setGroup("ImportExport");
	QString defaultEncodingForMSAccessFiles = kapp->config()->readEntry("DefaultEncodingForMSAccessFiles");
	if (!defaultEncodingForMSAccessFiles.isEmpty()) {
		m_encodingComboBox->setSelectedEncoding(defaultEncodingForMSAccessFiles);
		m_chkAlwaysUseThisEncoding->setChecked(true);
	}

	adjustSize();
	m_encodingComboBox->setFocus();
}
Пример #11
0
void GaduEditAccountWidget::createGeneralTab(QTabWidget *tabWidget)
{
	QWidget *generalTab = new QWidget(this);

	QGridLayout *layout = new QGridLayout(generalTab);
	QWidget *form = new QWidget(generalTab);
	layout->addWidget(form, 0, 0);

	QFormLayout *formLayout = new QFormLayout(form);

	AccountId = new QLineEdit(this);
	AccountId->setValidator(createOwnedGaduIdValidator(AccountId).get());
	connect(AccountId, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
	formLayout->addRow(tr("Gadu-Gadu number") + ':', AccountId);

	AccountPassword = new QLineEdit(this);
	AccountPassword->setEchoMode(QLineEdit::Password);
	connect(AccountPassword, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
	formLayout->addRow(tr("Password") + ':', AccountPassword);

	RememberPassword = new QCheckBox(tr("Remember password"), this);
	RememberPassword->setChecked(true);
	connect(RememberPassword, SIGNAL(clicked()), this, SLOT(dataChanged()));
	formLayout->addRow(0, RememberPassword);

	auto remindUinLabel = new QLabel(QString("<a href='change'>%1</a>").arg(tr("Remind GG number")));
	remindUinLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByMouse);
	formLayout->addRow(0, remindUinLabel);
	connect(remindUinLabel, SIGNAL(linkActivated(QString)), this, SLOT(remindUin()));

	auto remindPasswordLabel = new QLabel(QString("<a href='change'>%1</a>").arg(tr("Remind Password")));
	remindPasswordLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByMouse);
	formLayout->addRow(0, remindPasswordLabel);
	connect(remindPasswordLabel, SIGNAL(linkActivated(QString)), this, SLOT(remindPassword()));

	Identities = m_pluginInjectedFactory->makeInjected<IdentitiesComboBox>(this);
	connect(Identities, SIGNAL(currentIndexChanged(int)), this, SLOT(dataChanged()));
	formLayout->addRow(tr("Account Identity") + ':', Identities);

	QLabel *infoLabel = new QLabel(tr("<font size='-1'><i>Select or enter the identity that will be associated with this account.</i></font>"), this);
	infoLabel->setWordWrap(true);
	infoLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
	infoLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
	formLayout->addRow(0, infoLabel);

	AccountAvatarWidget *avatarWidget = m_pluginInjectedFactory->makeInjected<AccountAvatarWidget>(account(), this);
	layout->addWidget(avatarWidget, 0, 1, Qt::AlignTop);

	tabWidget->addTab(generalTab, tr("General"));
}
Пример #12
0
void StatusBar::showRestartRequired() {
  // Restart required notification
  const QString restart_text = tr("qBittorrent needs to be restarted");
  QLabel *restartIconLbl = new QLabel(m_bar);
  restartIconLbl->setPixmap(QPixmap(":/icons/oxygen/dialog-warning.png").scaled(QSize(24,24)));
  restartIconLbl->setToolTip(restart_text);
  m_bar->insertWidget(0,restartIconLbl);
  QLabel *restartLbl = new QLabel(m_bar);
  restartLbl->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
  m_bar->insertWidget(1, restartLbl);
  QFontMetrics fm(restartLbl->font());
  restartLbl->setText(fm.elidedText(restart_text, Qt::ElideRight, restartLbl->width()));
  Logger::instance()->addMessage(tr("qBittorrent was just updated and needs to be restarted for the changes to be effective."), Log::CRITICAL);
}
Пример #13
0
void MENU_KERNEL::ADD_MENU_KERNEL_LABEL ( QLayout * layout,int label_type,QString label_text,int index )
{
    QLabel * label = new QLabel ( label_text, this );

    if ( label_type EQ MENU_HEADER_ITEM ) {
         label->setStyleSheet( "QLabel { font: 14px \"Serif\"; }; " );
        label->setSizePolicy ( QSizePolicy::Expanding,QSizePolicy::Fixed );
        label->setAlignment  ( Qt::AlignLeft );
    }

    SET_WIDGET_DEFAULTS ( label,index );

    layout->addWidget ( label );
}
Пример #14
0
void UIVMDesktopPrivate::prepareErrorPane()
{
    if (m_pErrBox)
        return;

    /* Create error pane: */
    m_pErrBox = new QWidget;

    /* Create main layout: */
    QVBoxLayout *pMainLayout = new QVBoxLayout(m_pErrBox);
    pMainLayout->setContentsMargins(gsLeftMargin, gsTopMargin, gsRightMargin, gsBottomMargin);
    pMainLayout->setSpacing(10);

    /* Create error label: */
    m_pErrLabel = new QLabel(m_pErrBox);
    m_pErrLabel->setWordWrap(true);
    m_pErrLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    pMainLayout->addWidget(m_pErrLabel);

    /* Create error text browser: */
    m_pErrText = new QTextBrowser(m_pErrBox);
    m_pErrText->setFocusPolicy(Qt::StrongFocus);
    m_pErrText->document()->setDefaultStyleSheet("a { text-decoration: none; }");
    pMainLayout->addWidget(m_pErrText);

    /* If refresh action was set: */
    if (m_pRefreshAction)
    {
        /* Create refresh button: */
        m_pRefreshButton = new QToolButton(m_pErrBox);
        m_pRefreshButton->setFocusPolicy(Qt::StrongFocus);

        /* Create refresh button layout: */
        QHBoxLayout *pButtonLayout = new QHBoxLayout;
        pMainLayout->addLayout(pButtonLayout);
        pButtonLayout->addStretch();
        pButtonLayout->addWidget(m_pRefreshButton);

        /* Connect refresh button: */
        connect(m_pRefreshButton, SIGNAL(clicked()), m_pRefreshAction, SIGNAL(triggered()));
    }

    pMainLayout->addStretch();

    /* Add into the stack: */
    addWidget(m_pErrBox);

    /* Retranslate finally: */
    retranslateUi();
}
Пример #15
0
QLayout *ZDLInterface::getBottomPane(){
	QVBoxLayout *box = new QVBoxLayout();
	QLabel *ecla = new QLabel("Extra command line arguments",this);
	ecla->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed));
	extraArgs = new QLineEdit(this);
	QLayout *pan = getButtonPane();
	layout()->setContentsMargins(0,0,0,0);
	setContentsMargins(0,0,0,0);
	box->setSpacing(2);
	box->addWidget(ecla);
	box->addWidget(extraArgs);
	box->addLayout(pan);
	return box;
}
Пример #16
0
RegWidget::RegWidget(const char *name, IGui *gui, QWidget *parent) 
    : QWidget(parent) {
    igui_ = gui;
    value_ = 0;

    name_ = QString(name);
    while (name_.size() < 3) {
        name_ += tr(" ");
    }

    std::string t1 = "reg " + std::string(name);
    cmdRead_.make_string(t1.c_str());

    QFont font = QFont("Courier");
    font.setStyleHint(QFont::Monospace);
    font.setPointSize(8);
    font.setFixedPitch(true);
    setFont(font);
    QFontMetrics fm(font);

    QHBoxLayout *pLayout = new QHBoxLayout;
    pLayout->setContentsMargins(4, 1, 4, 1);
    setLayout(pLayout);

    QLabel *label = new QLabel(this);
    QSizePolicy labelSizePolicy(QSizePolicy::Preferred, 
                                QSizePolicy::Preferred);
    labelSizePolicy.setHorizontalStretch(0);
    labelSizePolicy.setVerticalStretch(0);
    labelSizePolicy.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
    label->setSizePolicy(labelSizePolicy);
    label->setText(name_);
    label->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
    pLayout->addWidget(label);

    edit_ = new QLineEdit(this);
    pLayout->addWidget(edit_);
    respValue_ = value_ = 0xfeedfaceull;

    char tstr[64];
    RISCV_sprintf(tstr, sizeof(tstr), "%016" RV_PRI64 "x", value_);
    QString text(tstr);
    edit_->setText(text);
    edit_->setMaxLength(19);
    edit_->setFixedWidth(fm.width(text) + 8);
    edit_->setFixedHeight(fm.height() + 2);

    setMinimumWidth(edit_->width() + fm.width(name_) + 16);
    setMinimumHeight(edit_->height());
}
Пример #17
0
void GCOutputWindow::computationCompleted(QImage result)
{
  QLabel* imagelabel = new QLabel(this);
  imagelabel->setBackgroundRole(QPalette::Base);
  imagelabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
  imagelabel->setPixmap(QPixmap::fromImage(result));
  imagelabel->adjustSize();

  QScrollArea* scrollview = new QScrollArea(this);
  scrollview->setWidget(imagelabel);

  m_OutputTabView->addTab(scrollview, "Mask");
  m_OutputTabView->setCurrentWidget(scrollview);
  m_OutputStackView->setCurrentIndex(1);
}
Пример #18
0
SensorsConfig::SensorsConfig(KSim::PluginObject *parent, const char *name)
   : KSim::PluginPage(parent, name)
{
  m_layout = new QGridLayout(this);
  m_layout->setSpacing(6);
  m_neverShown = true;

  m_sensorView = new KListView(this);
  m_sensorView->addColumn(i18n("No."));
  m_sensorView->addColumn(i18n("Label"));
  m_sensorView->addColumn(i18n("Sensors"));
  m_sensorView->addColumn(i18n("Value"));
  m_sensorView->setColumnWidth(0, 40);
  m_sensorView->setColumnWidth(1, 60);
  m_sensorView->setColumnWidth(2, 80);
  m_sensorView->setAllColumnsShowFocus(true);
  connect(m_sensorView, SIGNAL(contextMenu(KListView *,
     QListViewItem *, const QPoint &)), this, SLOT(menu(KListView *,
     QListViewItem *, const QPoint &)));

  connect( m_sensorView, SIGNAL( doubleClicked( QListViewItem * ) ),
     SLOT( modify( QListViewItem * ) ) );

  m_layout->addMultiCellWidget(m_sensorView, 1, 1, 0, 3);

  m_modify = new QPushButton( this );
  m_modify->setText( i18n( "Modify..." ) );
  connect( m_modify, SIGNAL( clicked() ), SLOT( modify() ) );
  m_layout->addMultiCellWidget( m_modify, 2, 2, 3, 3 );

  m_fahrenBox = new QCheckBox(i18n("Display Fahrenheit"), this);
  m_layout->addMultiCellWidget(m_fahrenBox, 3, 3, 0, 3);

  m_updateLabel = new QLabel(this);
  m_updateLabel->setText(i18n("Update interval:"));
  m_updateLabel->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
     QSizePolicy::Fixed));
  m_layout->addMultiCellWidget(m_updateLabel, 4, 4, 0, 0);

  m_sensorSlider = new KIntSpinBox(this);
  m_layout->addMultiCellWidget(m_sensorSlider, 4, 4, 1, 1);

  QLabel *intervalLabel = new QLabel(this);
  intervalLabel->setText(i18n("seconds"));
  intervalLabel->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
     QSizePolicy::Fixed));
  m_layout->addMultiCellWidget(intervalLabel, 4, 4, 2, 2);
}
Пример #19
0
void MpcGui::createControlWidget() {
	controlwidget = new QToolBar( this );
	controlwidget->setObjectName("controlwidget");
	controlwidget->setLayoutDirection(Qt::LeftToRight);

	controlwidget->setMovable(false);
	controlwidget->setAllowedAreas(Qt::BottomToolBarArea);
	controlwidget->addAction(playAct);
	controlwidget->addAction(pauseAct);
	controlwidget->addAction(stopAct);
	controlwidget->addSeparator();
	controlwidget->addAction(rewind3Act);
	controlwidget->addAction(rewind1Act);
	controlwidget->addAction(forward1Act);
	controlwidget->addAction(forward3Act);
	controlwidget->addSeparator();
	controlwidget->addAction(frameStepAct);
	controlwidget->addSeparator();

	QLabel* pLabel = new QLabel(this);
	pLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
	controlwidget->addWidget(pLabel);

	controlwidget->addAction(muteAct);
	controlwidget->addAction(volumeslider_action);

	timeslidewidget = new QToolBar( this );
	timeslidewidget->setObjectName("timeslidewidget");
	timeslidewidget->setLayoutDirection(Qt::LeftToRight);
	timeslidewidget->addAction(timeslider_action);
	timeslidewidget->setMovable(false);

	/*
	QColor SliderColor = palette().color(QPalette::Window);
	QColor SliderBorderColor = palette().color(QPalette::Dark);
	*/
	setIconSize( QSize( 16 , 16 ) );

	addToolBar(Qt::BottomToolBarArea, controlwidget);
	addToolBarBreak(Qt::BottomToolBarArea);
	addToolBar(Qt::BottomToolBarArea, timeslidewidget);

	controlwidget->setStyle(new MpcToolbarStyle() );
	timeslidewidget->setStyle(new MpcToolbarStyle() );

	statusBar()->show();
}
Пример #20
0
void DarkSilkGUI::createToolBars() {
    QLabel* header = new QLabel();
    header->setMinimumSize(48, 48);
    header->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    header->setPixmap(QPixmap(":/icons/darksilk"));
    header->setMaximumSize(48, 48);
    header->setScaledContents(true);

    toolbar = new QToolBar(tr("Tabs toolbar"));
    toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    toolbar->setContextMenuPolicy(Qt::PreventContextMenu);
    toolbar->setObjectName("tabs");
    toolbar->setStyleSheet("#tabs { background-color: qradialgradient(cx: -0.8, cy: 0, fx: -0.8, fy: 0, radius: 0.6, stop: 0 #000000, stop: 1 #000000);  }");
    toolbar->addWidget(header);

    QMenu *toolbarMenu = new QMenu();
    toolbarMenu->addAction(overviewAction);
    toolbarMenu->addAction(receiveCoinsAction);
    toolbarMenu->addAction(sendCoinsAction);
    toolbarMenu->addAction(historyAction);
    toolbarMenu->addAction(addressBookAction);
    toolbarMenu->addAction(statisticsAction);
    toolbarMenu->addAction(blockAction);
    toolbarMenu->addAction(stormnodeManagerAction);

    QAction* menuAction = new QAction(QIcon(":/icons/overview"), tr("&Menu"), this);
    menuAction->setToolTip(tr("Access DarkSilk Wallet Tabs"));
    menuAction->setCheckable(false);

    QToolButton* menuToolButton = new QToolButton();
    menuToolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
    menuToolButton->setMenu(toolbarMenu);
    menuToolButton->setPopupMode(QToolButton::InstantPopup);
    menuToolButton->setDefaultAction(menuAction);

    netLabel = new QLabel();
    netLabel->setObjectName("netLabel");
    netLabel->setStyleSheet("#netLabel { color: #ffffff; }");

    toolbar->addWidget(menuToolButton);
    toolbar->addWidget(makeToolBarSpacer());
    toolbar->addWidget(netLabel);
    toolbar->setOrientation(Qt::Horizontal);
    toolbar->setMovable(false);

    addToolBar(Qt::TopToolBarArea, toolbar);
}
Пример #21
0
void SearchView::updateRecentKeywords() {
    // load
    QSettings settings;
    QStringList keywords = settings.value(recentKeywordsKey).toStringList();
    if (keywords == recentKeywords) return;
    recentKeywords = keywords;

    // cleanup
    QLayoutItem *item;
    while ((item = recentKeywordsLayout->takeAt(1)) != 0) {
        item->widget()->close();
        delete item;
    }

    recentKeywordsLabel->setVisible(!keywords.isEmpty());
    The::globalActions()->value("clearRecentKeywords")->setEnabled(!keywords.isEmpty());

    foreach (const QString &keyword, keywords) {
        QString link = keyword;
        QString display = keyword;
        if (keyword.startsWith("http://") || keyword.startsWith("https://")) {
            int separator = keyword.indexOf("|");
            if (separator > 0 && separator + 1 < keyword.length()) {
                link = keyword.left(separator);
                display = keyword.mid(separator+1);
            }
        }
        bool needStatusTip = false;
        if (display.length() > 24) {
            display.truncate(24);
            display.append("...");
            needStatusTip = true;
        }
        QLabel *itemLabel = new QLabel("<a href=\"" + link
                                       + "\" style=\"color:palette(text); text-decoration:none\">"
                                       + display + "</a>", this);
        itemLabel->setAttribute(Qt::WA_DeleteOnClose);
        itemLabel->setProperty("recentItem", true);
        itemLabel->setMaximumWidth(queryEdit->toWidget()->width() + watchButton->width());
        itemLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
        // Make links navigable with the keyboard too
        itemLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByMouse);
        if (needStatusTip)
            itemLabel->setStatusTip(link);
        connect(itemLabel, SIGNAL(linkActivated(QString)), this, SLOT(watchKeywords(QString)));
        recentKeywordsLayout->addWidget(itemLabel);
    }
Пример #22
0
BTSettingsMainWindow::BTSettingsMainWindow(QWidget *parent, Qt::WFlags fl)
    : QMainWindow(parent, fl), m_localDevice(new QBluetoothLocalDevice(this)),
      m_controller(0)
{
    if (!m_localDevice->isValid()) {
        QLabel *label = new QLabel(tr("(Bluetooth not available.)"));
        label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
        label->setWordWrap(true);
        label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        setCentralWidget(label);
        return;
    }

    QScrollArea* scroll = new QScrollArea();
    scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scroll->setWidgetResizable(true);
    scroll->setFrameStyle(QFrame::NoFrame);

    m_menu = QSoftMenuBar::menuFor(this);
    m_tabs = new QTabWidget();

    m_controller =
            new QCommDeviceController(m_localDevice->deviceName().toLatin1(), this);

    SettingsDisplay *settings = new SettingsDisplay(m_localDevice, m_controller);
    scroll->setWidget(settings);
    scroll->setFocusProxy(settings);
    m_tabs->addTab(scroll, tr("Settings"));

    // Delay initialization of tabs other than the first
    m_tabs->addTab(new QWidget, tr("Paired Devices"));
    m_tabs->setTabEnabled(1, false);

    m_tabs->setCurrentIndex(0);

    // change the context menu when the tab changes
    connect(m_tabs, SIGNAL(currentChanged(int)), SLOT(tabChanged(int)));

    // set the current context menu
    tabChanged(m_tabs->currentIndex());

    setCentralWidget(m_tabs);
    setWindowTitle(tr("Bluetooth"));

    QTimer::singleShot(0, this, SLOT(init()));
}
Пример #23
0
DeleteDialog::DeleteDialog(const QString & title, const QString & text, bool deleteFileCheckBox, QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags)
{
	// we use this dialog instead of the normal QMessageBox because it's currently hard if not impossible to add a checkbox to QMessageBox.
	// supposedly this will be fixed in a future release of Qt.

    this->setWindowTitle(title);
	this->setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint |  Qt::WindowCloseButtonHint);

	QVBoxLayout * vlayout = new QVBoxLayout(this);

	QFrame * frame  = new QFrame(this);
	QHBoxLayout * hlayout = new QHBoxLayout(frame);

    QLabel * iconLabel = new QLabel;
	iconLabel->setPixmap(QMessageBox::standardIcon(QMessageBox::Warning));
    iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    QLabel * label = new QLabel;
	label->setWordWrap(true);
	label->setText(text);

	hlayout->addWidget(iconLabel);
	hlayout->addWidget(label);

	vlayout->addWidget(frame);

	m_checkBox = NULL;
	if (deleteFileCheckBox) {
		m_checkBox = new QCheckBox(tr("Also delete the file"));
		vlayout->addSpacing(7);
		vlayout->addWidget(m_checkBox);
		vlayout->addSpacing(15);
	}

    m_buttonBox = new QDialogButtonBox;
	m_buttonBox->addButton(QDialogButtonBox::Yes);
	m_buttonBox->addButton(QDialogButtonBox::No);
	m_buttonBox->button(QDialogButtonBox::Yes)->setText(tr("Remove"));
	m_buttonBox->button(QDialogButtonBox::No)->setText(tr("Don't remove"));

    QObject::connect(m_buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
	vlayout->addWidget(m_buttonBox);

    this->setModal(true);
}
Пример #24
0
ImagePropertiesDialog::ImagePropertiesDialog(const QIcon& icon, const QString& name, TagManager* manager, const QString& image, QWidget* parent)
	: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
	m_image(image),
	m_manager(manager)
{
	setWindowTitle(tr("Image Properties"));

	QLabel* preview = new QLabel(this);
	preview->setAlignment(Qt::AlignCenter);
	preview->setPixmap(icon.pixmap(74,74));
	preview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

	// Add name
	m_name = new QLineEdit(name, this);

	// Add tags
	m_tags = new QListWidget(this);
	m_tags->setSortingEnabled(true);
	QStringList tags = m_manager->tags();
	for (const QString& tag : tags) {
		QListWidgetItem* item = new QListWidgetItem(tag, m_tags);
		item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
		item->setCheckState(m_manager->images(tag).contains(image) ? Qt::Checked : Qt::Unchecked);
	}
	if (m_tags->count() > 0) {
		QListWidgetItem* item = m_tags->item(0);
		item->setSelected(true);
		m_tags->setCurrentItem(item);
	}

	// Add dialog buttons
	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
	connect(buttons, &QDialogButtonBox::accepted, this, &ImagePropertiesDialog::accept);
	connect(buttons, &QDialogButtonBox::rejected, this, &ImagePropertiesDialog::reject);

	// Layout dialog
	QFormLayout* layout = new QFormLayout(this);
	layout->addRow(preview);
	layout->addRow(tr("Name:"), m_name);
	layout->addRow(tr("Tags:"), m_tags);
	layout->addRow(buttons);

	// Resize dialog
	resize(QSettings().value("ImageProperties/Size", sizeHint()).toSize());
}
Пример #25
0
void LoadPage::setupUi()
{
    QVBoxLayout * l = new QVBoxLayout; {
        QLabel * infoLabel = new QLabel; {
            infoLabel->setText("Выберите файл с данными\n"
                               "Предполагается, что числа в файле разделены символом \";\", "
                               "а в качестве дробного знака используется точка");
            infoLabel->setWordWrap(true);
            infoLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
        }

        QPushButton * openFile = new QPushButton("Открыть файл"); {
            connect(openFile, SIGNAL(clicked()), this, SLOT(openFileDialog()) );
        }

        QHBoxLayout * buttonLayout = new QHBoxLayout; {

            QPushButton * nextButton = new QPushButton("Далее"); {
                nextButton->setEnabled(false);
                connect(nextButton, SIGNAL(clicked()), this, SIGNAL(nextPage()) );
                connect(this, SIGNAL(dataRead(bool)), nextButton, SLOT(setEnabled(bool)) );
            }

            QPushButton * backButton = new QPushButton("Назад"); {
                // fake button
                backButton->setEnabled(false);
            }

            buttonLayout->addWidget(backButton);
            buttonLayout->addWidget(nextButton);
        }

        table = new QTableWidget; {
            table->setEditTriggers(QTableWidget::NoEditTriggers);
        }

        l->addWidget(infoLabel);
        l->addWidget(openFile);
        l->addWidget(table);
        l->addLayout(buttonLayout);
    }

    this->setLayout(l);
}
Пример #26
0
void JabberEditAccountWidget::createGeneralTab(QTabWidget *tabWidget)
{
	QWidget *generalTab = new QWidget(this);

	QGridLayout *layout = new QGridLayout(generalTab);
	QWidget *form = new QWidget(generalTab);
	layout->addWidget(form, 0, 0);

	QFormLayout *formLayout = new QFormLayout(form);

	AccountId = new QLineEdit(this);
	connect(AccountId, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
	formLayout->addRow(tr("Username") + ':', AccountId);

	AccountPassword = new QLineEdit(this);
	AccountPassword->setEchoMode(QLineEdit::Password);
	connect(AccountPassword, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
	formLayout->addRow(tr("Password") + ':', AccountPassword);

	RememberPassword = new QCheckBox(tr("Remember password"), this);
	RememberPassword->setChecked(true);
	connect(RememberPassword, SIGNAL(clicked()), this, SLOT(dataChanged()));
	formLayout->addRow(0, RememberPassword);

	QLabel *changePasswordLabel = new QLabel(QString("<a href='change'>%1</a>").arg(tr("Change your password")));
	changePasswordLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByMouse);
	formLayout->addRow(0, changePasswordLabel);
	connect(changePasswordLabel, SIGNAL(linkActivated(QString)), this, SLOT(changePasssword()));

	Identities = new IdentitiesComboBox(false, this);
	connect(Identities, SIGNAL(identityChanged(Identity)), this, SLOT(dataChanged()));
	formLayout->addRow(tr("Account Identity") + ':', Identities);

	QLabel *infoLabel = new QLabel(tr("<font size='-1'><i>Select or enter the identity that will be associated with this account.</i></font>"), this);
	infoLabel->setWordWrap(true);
	infoLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
	infoLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
	formLayout->addRow(0, infoLabel);

	AccountAvatarWidget *avatarWidget = new AccountAvatarWidget(account(), this);
	layout->addWidget(avatarWidget, 0, 1, Qt::AlignTop);

	tabWidget->addTab(generalTab, tr("General"));
}
Пример #27
0
Guitar::Guitar(QString name, QString fingers, QWidget *parent) : name_(name), fingers_(fingers),
    QFrame(parent)
{
    QVBoxLayout *vlayout = new QVBoxLayout(this);
    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setSizeConstraint(QLayout::SetMinimumSize);

    this->setFrameStyle(QFrame::Box);
    this->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
    //this->setMinimumSize(150,200);
    //this->setMaximumWidth(200);

    QLabel *label = new QLabel(" " + name_ + " ");
    label->setFrameStyle(QFrame::Box);
    label->setAlignment(Qt::AlignCenter);
    label->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);


    buttonClose_ = new QToolButton();
    buttonClose_->setIcon( this->style()->standardIcon(QStyle::SP_DialogCloseButton) );
    connect(buttonClose_,SIGNAL(clicked()),this,SLOT(pressClose()));

    buttonReduce_ = new QToolButton();
    //buttonReduce_->setIcon( this->style()->standardIcon(QStyle::SP_TitleBarShadeButton) );
    buttonReduce_->setCheckable(true);

    QIcon icon;
    icon.addPixmap( this->style()->standardIcon(QStyle::SP_TitleBarUnshadeButton).pixmap(16), QIcon::Normal, QIcon::On );
    icon.addPixmap( this->style()->standardIcon(QStyle::SP_TitleBarShadeButton).pixmap(16), QIcon::Normal, QIcon::Off );
    buttonReduce_->setIcon(icon);

    strings = new Strings(fingers_,this);

    connect(buttonReduce_,SIGNAL(toggled(bool)),strings,SLOT(setHidden(bool)));
    //connect(buttonReduce_,SIGNAL(toggled(bool)),this,SLOT(reduced(bool)));

    hlayout->addWidget(label);
    hlayout->addWidget(buttonReduce_);
    hlayout->addWidget(buttonClose_);

    vlayout->addLayout(hlayout);
    vlayout->addWidget(strings);
}
Пример #28
0
QWidget *AppAboutPage::createPage(QWidget *parent)
{
    QWidget *w = new QWidget(parent);
    QVBoxLayout *layout = new QVBoxLayout(w);
    layout->setSpacing(0);
    layout->setMargin(0);

    // Splash label
    QWidget *sw = new QWidget(w);
    QHBoxLayout *swLayout = new QHBoxLayout(sw);
    sw->setLayout(swLayout);
    QLabel *splash = new QLabel(w);
    splash->setPixmap(theme()->splashScreenPixmap(settings()->path(Core::ISettings::SplashScreen)));
    splash->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    swLayout->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding));
    swLayout->addWidget(splash);
    swLayout->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding));
    layout->addWidget(sw);
    QFrame *line = new QFrame(w);
    line->setFrameShape(QFrame::HLine);
    line->setFrameShadow(QFrame::Sunken);
    layout->addWidget(line);
    layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed));

    // Welcome label
    QLabel *label = new QLabel(w);
    label->setWordWrap(true);
    label->setOpenExternalLinks(true);
    layout->addWidget(label);
    layout->addSpacerItem(new QSpacerItem(20,20, QSizePolicy::Expanding, QSizePolicy::Expanding));
    label->clear();
        Utils::UpdateChecker *up = Core::ICore::instance()->updateChecker();
    QString tmp = tkTr(Trans::Constants::APPLICATION_ABOUT_YEAR_1_WEB_2)
                   .arg(QDate::currentDate().year())
                   .arg(qApp->organizationDomain());
    if (up->hasUpdate()) {
        tmp.append(tkTr(Trans::Constants::UPDATE_AVAILABLE));
    } else {
        tmp.append(tkTr(Trans::Constants::VERSION_UPTODATE));
    }
    label->setText(tmp);
    return w;
}
void
SummaryWidget::createDiskMaps()
{
    DiskList disks;

    const QCString free = i18n( "Free" ).local8Bit();
    const QCString used = i18n( "Used" ).local8Bit();

    KIconLoader loader;

    oldScheme = Config::scheme;
    Config::scheme = (Filelight::MapScheme)2000;

    for (DiskList::ConstIterator it = disks.begin(), end = disks.end(); it != end; ++it)
    {
        Disk const &disk = *it;

        if (disk.free == 0 && disk.used == 0)
            continue;

        QWidget *box = new QVBox( this );
        RadialMap::Widget *map = new MyRadialMap( box );

        QString text; QTextOStream( &text )
            << "<img src='" << loader.iconPath( disk.icon, KIcon::Toolbar ) << "'>"
            << " &nbsp;" << disk.mount << " "
            << "<i>(" << disk.device << ")</i>";

        QLabel *label = new QLabel( text, box );
        label->setAlignment( Qt::AlignCenter );
        label->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum );

        box->show(); // will show its children too

        Directory *tree = new Directory( disk.mount.local8Bit() );
        tree->append( free, disk.free );
        tree->append( used, disk.used );

        map->create( tree ); //must be done when visible

        connect( map, SIGNAL(activated( const KURL& )), SIGNAL(activated( const KURL& )) );
    }
}
Пример #30
0
void ScanDialog::createOptionsTab( void )
{

   QVBox *page = addVBoxPage( i18n("&Options"));
   setMainWidget(page);

   QGroupBox *gb = new QGroupBox( 1, Qt::Horizontal, i18n("Startup Options"), page, "GB_STARTUP" );
   QLabel *label = new QLabel( i18n( "Note: changing these options will affect the scan plugin on next start." ),
			       gb );
   label->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed ) );

   /* Checkbox for asking for scanner on startup */
   cb_askOnStart = new QCheckBox( i18n( "&Ask for the scan device on plugin startup"), gb );
   QToolTip::add( cb_askOnStart,
		  i18n("You can uncheck this if you do not want to be asked which scanner to use on startup."));
   Q_CHECK_PTR( cb_askOnStart );

   /* Checkbox for network access */
   cb_network = new QCheckBox( i18n( "&Query the network for scan devices"), gb );
   QToolTip::add( cb_network,
		  i18n("Check this if you want to query for configured network scan stations."));
   Q_CHECK_PTR( cb_network );


   /* Read settings for startup behavior */
   KConfig *gcfg = KGlobal::config();
   gcfg->setGroup(QString::fromLatin1(GROUP_STARTUP));
   bool skipDialog  = gcfg->readBoolEntry( STARTUP_SKIP_ASK, false );
   bool onlyLocal   = gcfg->readBoolEntry( STARTUP_ONLY_LOCAL, false );

   /* Note: flag must be inverted because of question is 'the other way round' */
   cb_askOnStart->setChecked( !skipDialog );
   connect( cb_askOnStart, SIGNAL(toggled(bool)), this, SLOT(slotAskOnStartToggle(bool)));

   cb_network->setChecked( !onlyLocal );
   connect( cb_network, SIGNAL(toggled(bool)), this, SLOT(slotNetworkToggle(bool)));


   QWidget *spaceEater = new QWidget( page );
   Q_CHECK_PTR( spaceEater );
   spaceEater->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding) );

}