本文整理汇总了C++中KVBox::setSpacing方法的典型用法代码示例。如果您正苦于以下问题:C++ KVBox::setSpacing方法的具体用法?C++ KVBox::setSpacing怎么用?C++ KVBox::setSpacing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KVBox
的用法示例。
在下文中一共展示了KVBox::setSpacing方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: config
PreProcessingPage::PreProcessingPage(Manager* const mngr, KAssistantDialog* const dlg)
: KPWizardPage(dlg, i18n("<b>Pre-Processing Images</b>")),
d(new PreProcessingPagePriv)
{
d->mngr = mngr;
d->progressTimer = new QTimer(this);
KVBox* vbox = new KVBox(this);
d->title = new QLabel(vbox);
d->title->setWordWrap(true);
d->title->setOpenExternalLinks(true);
KConfig config("kipirc");
KConfigGroup group = config.group(QString("Panorama Settings"));
d->celesteCheckBox = new QCheckBox(i18n("Detect moving skies"), vbox);
d->celesteCheckBox->setChecked(group.readEntry("Celeste", false));
d->celesteCheckBox->setToolTip(i18n("Automatic detection of clouds to prevent wrong keypoints matching "
"between images due to moving clouds."));
d->celesteCheckBox->setWhatsThis(i18n("<b>Detect moving skies</b>: During the control points selection and matching, "
"this option discards any points that are associated to a possible cloud. This "
"is useful to prevent moving clouds from altering the control points matching "
"process."));
QLabel* space1 = new QLabel(vbox);
KHBox* hbox = new KHBox(vbox);
d->detailsBtn = new QPushButton(hbox);
d->detailsBtn->setText(i18n("Details..."));
d->detailsBtn->hide();
QLabel* space2 = new QLabel(hbox);
hbox->setStretchFactor(space2, 10);
QLabel* space3 = new QLabel(vbox);
d->progressLabel = new QLabel(vbox);
d->progressLabel->setAlignment(Qt::AlignCenter);
QLabel* space4 = new QLabel(vbox);
vbox->setStretchFactor(space1, 2);
vbox->setStretchFactor(space3, 2);
vbox->setStretchFactor(space4, 10);
vbox->setSpacing(KDialog::spacingHint());
vbox->setMargin(KDialog::spacingHint());
setPageWidget(vbox);
resetTitle();
QPixmap leftPix = KStandardDirs::locate("data", "kipiplugin_panorama/pics/assistant-preprocessing.png");
setLeftBottomPix(leftPix.scaledToWidth(128, Qt::SmoothTransformation));
// connect(d->mngr->thread(), SIGNAL(starting(KIPIPanoramaPlugin::ActionData)),
// this, SLOT(slotAction(KIPIPanoramaPlugin::ActionData)));
connect(d->progressTimer, SIGNAL(timeout()),
this, SLOT(slotProgressTimerDone()));
connect(d->detailsBtn, SIGNAL(clicked()),
this, SLOT(slotShowDetails()));
}
示例2: QToolButton
VolumePopupButton::VolumePopupButton( QWidget * parent, PlayerManager *mgr ) :
QToolButton( parent ),
m_prevVolume(0.0),
m_curVolume(0.0),
player(mgr)
{
//create the volume popup
m_volumeMenu = new QMenu( this );
KVBox *mainBox = new KVBox( this );
m_volumeLabel= new QLabel( mainBox );
m_volumeLabel->setAlignment( Qt::AlignHCenter );
KHBox *sliderBox = new KHBox( mainBox );
m_volumeSlider = new VolumeSlider( 100, sliderBox, false );
m_volumeSlider->setFixedHeight( 170 );
mainBox->setMargin( 0 );
mainBox->setSpacing( 0 );
sliderBox->setSpacing( 0 );
sliderBox->setMargin( 0 );
mainBox->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
sliderBox->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
QWidgetAction *sliderActionWidget = new QWidgetAction( this );
sliderActionWidget->setDefaultWidget( mainBox );
// volumeChanged is a customSignal, is not emited by setValue()
connect( m_volumeSlider, SIGNAL(volumeChanged(float)), player, SLOT(setVolume(float)) );
QToolBar *muteBar = new QToolBar( QString(), mainBox );
muteBar->setContentsMargins( 0, 0, 0, 0 );
muteBar->setIconSize( QSize( 16, 16 ) );
// our popup's mute-toggle button
m_muteAction = new QAction( KIcon( "audio-volume-muted" ), QString(), muteBar );
m_muteAction->setToolTip( i18n( "Mute/Unmute" ) );
connect( m_muteAction, SIGNAL(triggered(bool)), this, SLOT(slotToggleMute(bool)) );
connect( player, SIGNAL(mutedChanged(bool)), this, SLOT(slotMuteStateChanged(bool)) );
m_volumeMenu->addAction( sliderActionWidget );
muteBar->addAction( m_muteAction );
/* set icon and label to match create state of AudioOutput, as the
* desired volume value is not available yet (because the player
* object is not set up yet.) Someone must call PlayerManager::setVolume()
* later.
*/
slotVolumeChanged( 1.0 );
// let player notify us when volume changes
connect( player, SIGNAL(volumeChanged(float)), this, SLOT(slotVolumeChanged(float)) );
}
示例3: FolderDialogTab
KMail::FolderDialogACLTab::FolderDialogACLTab( KMFolderDialog* dlg, QWidget* parent )
: FolderDialogTab( dlg, parent ),
mImapAccount( 0 ),
mUserRights( 0 ),
mChanged( false ), mAccepting( false ), mSaving( false )
{
QVBoxLayout* topLayout = new QVBoxLayout( this );
// We need a widget stack to show either a label ("no acl support", "please wait"...)
// or a listview.
mStack = new QStackedWidget( this );
topLayout->addWidget( mStack );
mLabel = new QLabel( mStack );
mLabel->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
mLabel->setWordWrap( true );
mStack->addWidget( mLabel );
mACLWidget = new KHBox( mStack );
mACLWidget->setSpacing( KDialog::spacingHint() );
mListView = new QTreeWidget( mACLWidget );
QStringList headerNames;
headerNames << i18n("User Id") << i18n("Permissions");
mListView->setHeaderItem( new QTreeWidgetItem( headerNames ) );
mListView->setAllColumnsShowFocus( true );
mListView->setAlternatingRowColors( true );
mListView->setSortingEnabled( false );
mListView->setRootIsDecorated( false );
mStack->addWidget( mACLWidget );
connect( mListView, SIGNAL( itemActivated( QTreeWidgetItem*, int ) ),
SLOT( slotEditACL( QTreeWidgetItem* ) ) );
connect( mListView, SIGNAL( itemSelectionChanged() ),
SLOT( slotSelectionChanged() ) );
KVBox* buttonBox = new KVBox( mACLWidget );
buttonBox->setSpacing( KDialog::spacingHint() );
mAddACL = new KPushButton( i18n( "Add Entry..." ), buttonBox );
mEditACL = new KPushButton( i18n( "Modify Entry..." ), buttonBox );
mRemoveACL = new KPushButton( i18n( "Remove Entry" ), buttonBox );
QWidget *spacer = new QWidget( buttonBox );
spacer->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding );
connect( mAddACL, SIGNAL( clicked() ), SLOT( slotAddACL() ) );
connect( mEditACL, SIGNAL( clicked() ), SLOT( slotEditACL() ) );
connect( mRemoveACL, SIGNAL( clicked() ), SLOT( slotRemoveACL() ) );
mEditACL->setEnabled( false );
mRemoveACL->setEnabled( false );
connect( this, SIGNAL( changed(bool) ), SLOT( slotChanged(bool) ) );
}
示例4: config
PreProcessingPage::PreProcessingPage(Manager* const mngr, KAssistantDialog* const dlg)
: KPWizardPage(dlg, i18n("<b>Pre-Processing Bracketed Images</b>")),
d(new PreProcessingPagePriv)
{
d->mngr = mngr;
d->progressTimer = new QTimer(this);
KVBox *vbox = new KVBox(this);
d->title = new QLabel(vbox);
d->title->setWordWrap(true);
d->title->setOpenExternalLinks(true);
d->alignCheckBox = new QCheckBox(i18n("Align bracketed images"), vbox);
KConfig config("kipirc");
KConfigGroup group = config.group(QString("ExpoBlending Settings"));
d->alignCheckBox->setChecked(group.readEntry("Auto Alignment", true));
QLabel* space1 = new QLabel(vbox);
KHBox* hbox = new KHBox(vbox);
d->detailsBtn = new QPushButton(hbox);
d->detailsBtn->setText(i18n("Details..."));
d->detailsBtn->hide();
QLabel* space2 = new QLabel(hbox);
hbox->setStretchFactor(space2, 10);
QLabel* space3 = new QLabel(vbox);
d->progressLabel = new QLabel(vbox);
d->progressLabel->setAlignment(Qt::AlignCenter);
QLabel* space4 = new QLabel(vbox);
vbox->setStretchFactor(space1, 2);
vbox->setStretchFactor(space3, 2);
vbox->setStretchFactor(space4, 10);
vbox->setSpacing(KDialog::spacingHint());
vbox->setMargin(KDialog::spacingHint());
setPageWidget(vbox);
resetTitle();
QPixmap leftPix = KStandardDirs::locate("data", "kipiplugin_expoblending/pics/assistant-preprocessing.png");
setLeftBottomPix(leftPix.scaledToWidth(128, Qt::SmoothTransformation));
connect(d->mngr->thread(), SIGNAL(starting(KIPIExpoBlendingPlugin::ActionData)),
this, SLOT(slotAction(KIPIExpoBlendingPlugin::ActionData)));
connect(d->progressTimer, SIGNAL(timeout()),
this, SLOT(slotProgressTimerDone()));
connect(d->detailsBtn, SIGNAL(clicked()),
this, SLOT(slotShowDetails()));
}
示例5: QWidget
NavigationSettingsPage::NavigationSettingsPage(QWidget* parent) :
SettingsPageBase(parent),
m_openArchivesAsFolder(0),
m_autoExpandFolders(0)
{
const int spacing = KDialog::spacingHint();
QVBoxLayout* topLayout = new QVBoxLayout(this);
KVBox* vBox = new KVBox(this);
vBox->setSpacing(spacing);
// create 'Mouse' group
QGroupBox* mouseBox = new QGroupBox(i18nc("@title:group", "Mouse"), vBox);
mouseBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
m_singleClick = new QRadioButton(i18nc("@option:check Mouse Settings",
"Single-click to open files and folders"), mouseBox);
m_doubleClick = new QRadioButton(i18nc("@option:check Mouse Settings",
"Double-click to open files and folders"), mouseBox);
QVBoxLayout* mouseBoxLayout = new QVBoxLayout(mouseBox);
mouseBoxLayout->addWidget(m_singleClick);
mouseBoxLayout->addWidget(m_doubleClick);
m_openArchivesAsFolder = new QCheckBox(i18nc("@option:check", "Open archives as folder"), vBox);
m_autoExpandFolders = new QCheckBox(i18nc("option:check", "Open folders during drag operations"), vBox);
// Add a dummy widget with no restriction regarding
// a vertical resizing. This assures that the dialog layout
// is not stretched vertically.
new QWidget(vBox);
topLayout->addWidget(vBox);
loadSettings();
connect(m_singleClick, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
connect(m_doubleClick, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
connect(m_openArchivesAsFolder, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
connect(m_autoExpandFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
}
示例6: QLabel
StartupSettingsPage::StartupSettingsPage(const KUrl& url, QWidget* parent) :
SettingsPageBase(parent),
m_url(url),
m_homeUrl(0),
m_splitView(0),
m_editableUrl(0),
m_showFullPath(0),
m_filterBar(0)
{
const int spacing = KDialog::spacingHint();
QVBoxLayout* topLayout = new QVBoxLayout(this);
KVBox* vBox = new KVBox(this);
vBox->setSpacing(spacing);
// create 'Home URL' editor
QGroupBox* homeBox = new QGroupBox(i18nc("@title:group", "Home Folder"), vBox);
KHBox* homeUrlBox = new KHBox(homeBox);
homeUrlBox->setSpacing(spacing);
new QLabel(i18nc("@label:textbox", "Location:"), homeUrlBox);
m_homeUrl = new KLineEdit(homeUrlBox);
m_homeUrl->setClearButtonShown(true);
QPushButton* selectHomeUrlButton = new QPushButton(KIcon("folder-open"), QString(), homeUrlBox);
#ifndef QT_NO_ACCESSIBILITY
selectHomeUrlButton->setAccessibleName(i18nc("@action:button", "Select Home Location"));
#endif
connect(selectHomeUrlButton, SIGNAL(clicked()),
this, SLOT(selectHomeUrl()));
KHBox* buttonBox = new KHBox(homeBox);
buttonBox->setSpacing(spacing);
QPushButton* useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location"), buttonBox);
connect(useCurrentButton, SIGNAL(clicked()),
this, SLOT(useCurrentLocation()));
QPushButton* useDefaultButton = new QPushButton(i18nc("@action:button", "Use Default Location"), buttonBox);
connect(useDefaultButton, SIGNAL(clicked()),
this, SLOT(useDefaultLocation()));
QVBoxLayout* homeBoxLayout = new QVBoxLayout(homeBox);
homeBoxLayout->addWidget(homeUrlBox);
homeBoxLayout->addWidget(buttonBox);
// create 'Split view', 'Show full path', 'Editable location' and 'Filter bar' checkboxes
m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Split view mode"), vBox);
m_editableUrl = new QCheckBox(i18nc("@option:check Startup Settings", "Editable location bar"), vBox);
m_showFullPath = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path inside location bar"), vBox);
m_filterBar = new QCheckBox(i18nc("@option:check Startup Settings", "Show filter bar"), vBox);
// Add a dummy widget with no restriction regarding
// a vertical resizing. This assures that the dialog layout
// is not stretched vertically.
new QWidget(vBox);
topLayout->addWidget(vBox);
loadSettings();
connect(m_homeUrl, SIGNAL(textChanged(QString)), this, SLOT(slotSettingsChanged()));
connect(m_splitView, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged()));
connect(m_editableUrl, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged()));
connect(m_showFullPath, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged()));
connect(m_filterBar, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged()));
}
示例7: config
OptimizePage::OptimizePage(Manager* const mngr, KAssistantDialog* const dlg)
: KPWizardPage(dlg, i18n("<b>Optimization</b>")),
d(new OptimizePagePriv)
{
d->mngr = mngr;
KVBox* vbox = new KVBox(this);
d->progressTimer = new QTimer(this);
d->title = new QLabel(vbox);
d->title->setOpenExternalLinks(true);
d->title->setWordWrap(true);
KConfig config("kipirc");
KConfigGroup group = config.group(QString("Panorama Settings"));
d->horizonCheckbox = new QCheckBox(i18n("Level horizon"), vbox);
d->horizonCheckbox->setChecked(group.readEntry("Horizon", true));
d->horizonCheckbox->setToolTip(i18n("Detect the horizon and adapt the project to make it horizontal."));
d->horizonCheckbox->setWhatsThis(i18n("<b>Level horizon</b>: Detect the horizon and adapt the projection so that "
"the detected horizon is an horizontal line in the final panorama"));
d->projectionAndSizeCheckbox = new QCheckBox(i18n("Automatic projection and crop"), vbox);
d->projectionAndSizeCheckbox->setChecked(group.readEntry("Output Projection And Size", true));
d->projectionAndSizeCheckbox->setToolTip(i18n("Adapt the projection of the panorama and the cropping on the resulting "
"projection so that every photo fits in the resulting panorama."));
d->projectionAndSizeCheckbox->setWhatsThis(i18n("<b>Automatic projection and crop</b>: Automatically adapt the projection "
"and the crop of the panorama to get every photos into the panorama."));
d->preprocessResults = new QLabel(vbox);
QLabel* space1 = new QLabel(vbox);
vbox->setStretchFactor(space1, 2);
KHBox* hbox = new KHBox(vbox);
d->detailsBtn = new QPushButton(hbox);
d->detailsBtn->setText(i18n("Details..."));
d->detailsBtn->hide();
QLabel* space2 = new QLabel(hbox);
hbox->setStretchFactor(space2, 10);
QLabel* space3 = new QLabel(vbox);
vbox->setStretchFactor(space3, 2);
d->progressLabel = new QLabel(vbox);
d->progressLabel->setAlignment(Qt::AlignCenter);
QLabel* space4 = new QLabel(vbox);
vbox->setStretchFactor(space4, 10);
vbox->setSpacing(KDialog::spacingHint());
vbox->setMargin(KDialog::spacingHint());
setPageWidget(vbox);
resetTitle();
QPixmap leftPix = KStandardDirs::locate("data", "kipiplugin_panorama/pics/assistant-hugin.png");
setLeftBottomPix(leftPix.scaledToWidth(128, Qt::SmoothTransformation));
// connect(d->mngr->thread(), SIGNAL(starting(KIPIPanoramaPlugin::ActionData)),
// this, SLOT(slotAction(KIPIPanoramaPlugin::ActionData)));
connect(d->progressTimer, SIGNAL(timeout()),
this, SLOT(slotProgressTimerDone()));
connect(d->detailsBtn, SIGNAL(clicked()),
this, SLOT(slotShowDetails()));
}
示例8: KateDocItem
CloseConfirmDialog::CloseConfirmDialog(
QList<KTextEditor::Document*>& docs
, KToggleAction* show_confirmation_action
, QWidget* const parent
)
: KDialog(parent)
, m_docs(docs)
{
assert("Documents container expected to be non empty" && !docs.isEmpty());
setCaption(i18n("Close files confirmation"));
setButtons(Ok | Cancel);
setModal(true);
setDefaultButton(KDialog::Ok);
KVBox* w = new KVBox(this);
setMainWidget(w);
w->setSpacing(KDialog::spacingHint());
KHBox* lo1 = new KHBox(w);
// dialog text
QLabel* icon = new QLabel(lo1);
icon->setPixmap(DesktopIcon("dialog-warning"));
QLabel* t = new QLabel(
i18n(
"<qt>You are about to close the following documents..."
"<p>It is last chance to uncheck those you don't want to close ;-)</p></qt>"
)
, lo1
);
lo1->setStretchFactor(t, 1000);
// document list
m_docs_tree = new QTreeWidget(w);
QStringList headers;
headers << i18n("Document") << i18n("Location");
m_docs_tree->setHeaderLabels(headers);
m_docs_tree->setSelectionMode(QAbstractItemView::SingleSelection);
m_docs_tree->setRootIsDecorated(false);
for (int i = 0; i < m_docs.size(); i++)
{
new KateDocItem(m_docs[i], m_docs_tree);
}
m_docs_tree->header()->setStretchLastSection(false);
m_docs_tree->header()->setResizeMode(0, QHeaderView::ResizeToContents);
m_docs_tree->header()->setResizeMode(1, QHeaderView::ResizeToContents);
m_dont_ask_again = new QCheckBox(i18n("Do not ask again"), w);
// NOTE If we are here, it means that 'Show Confirmation' action is enabled,
// so not needed to read config...
assert("Sanity check" && show_confirmation_action->isChecked());
m_dont_ask_again->setCheckState(Qt::Checked);
connect(m_dont_ask_again, SIGNAL(toggled(bool)), show_confirmation_action, SLOT(setChecked(bool)));
// Update documents list according checkboxes
connect(this, SIGNAL(accepted()), this, SLOT(updateDocsList()));
KConfigGroup gcg(KGlobal::config(), "CloseConfirmationDialog");
restoreDialogSize(gcg); // restore dialog geometry from config
}
示例9: KateDocItem
KateMwModOnHdDialog::KateMwModOnHdDialog( DocVector docs, QWidget *parent, const char *name )
: KDialog( parent ),
m_proc( 0 ),
m_diffFile( 0 )
{
setCaption( i18n("Documents Modified on Disk") );
setButtons( User1 | User2 | User3 );
setButtonGuiItem( User1, KGuiItem (i18n("&Ignore"), "window-close") );
setButtonGuiItem( User2, KStandardGuiItem::overwrite() );
setButtonGuiItem( User3, KGuiItem (i18n("&Reload"), "view-refresh") );
setObjectName( name );
setModal( true );
setDefaultButton( KDialog::User3 );
setButtonWhatsThis( User1, i18n(
"Removes the modified flag from the selected documents and closes the "
"dialog if there are no more unhandled documents.") );
setButtonWhatsThis( User2, i18n(
"Overwrite selected documents, discarding the disk changes and closes the "
"dialog if there are no more unhandled documents.") );
setButtonWhatsThis( User3, i18n(
"Reloads the selected documents from disk and closes the dialog if there "
"are no more unhandled documents.") );
KVBox *w = new KVBox( this );
setMainWidget( w );
w->setSpacing( KDialog::spacingHint() );
KHBox *lo1 = new KHBox( w );
// dialog text
QLabel *icon = new QLabel( lo1 );
icon->setPixmap( DesktopIcon("dialog-warning") );
QLabel *t = new QLabel( i18n(
"<qt>The documents listed below have changed on disk.<p>Select one "
"or more at once, and press an action button until the list is empty.</p></qt>"), lo1 );
lo1->setStretchFactor( t, 1000 );
// document list
twDocuments = new QTreeWidget( w );
QStringList header;
header << i18n("Filename") << i18n("Status on Disk");
twDocuments->setHeaderLabels(header);
twDocuments->setSelectionMode( QAbstractItemView::SingleSelection );
twDocuments->setRootIsDecorated( false );
m_stateTexts << "" << i18n("Modified") << i18n("Created") << i18n("Deleted");
for ( int i = 0; i < docs.size(); i++ )
{
new KateDocItem( docs[i], m_stateTexts[ (uint)KateDocManager::self()->documentInfo( docs[i] )->modifiedOnDiscReason ], twDocuments );
}
twDocuments->header()->setStretchLastSection(false);
twDocuments->header()->setResizeMode(0, QHeaderView::Stretch);
twDocuments->header()->setResizeMode(1, QHeaderView::ResizeToContents);
connect( twDocuments, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(slotSelectionChanged(QTreeWidgetItem*,QTreeWidgetItem*)) );
// diff button
KHBox *lo2 = new KHBox ( w );
QWidget *d = new QWidget (lo2);
lo2->setStretchFactor (d, 2);
btnDiff = new KPushButton( KGuiItem (i18n("&View Difference"), "document-preview"), lo2 );
btnDiff->setWhatsThis(i18n(
"Calculates the difference between the editor contents and the disk "
"file for the selected document, and shows the difference with the "
"default application. Requires diff(1).") );
connect( btnDiff, SIGNAL(clicked()), this, SLOT(slotDiff()) );
connect( this, SIGNAL(user1Clicked()), this, SLOT(slotUser1()) );
connect( this, SIGNAL(user2Clicked()), this, SLOT(slotUser2()) );
connect( this, SIGNAL(user3Clicked()), this, SLOT(slotUser3()) );
slotSelectionChanged(NULL, NULL);
}
示例10: firstRunQuery
CoverFoundDialog::CoverFoundDialog( const CoverFetchUnit::Ptr unit,
const CoverFetch::Metadata &data,
QWidget *parent )
: KDialog( parent )
, m_album( unit->album() )
, m_isSorted( false )
, m_sortEnabled( false )
, m_unit( unit )
, m_queryPage( 0 )
{
DEBUG_BLOCK
setButtons( KDialog::Ok | KDialog::Cancel |
KDialog::User1 ); // User1: clear icon view
setButtonGuiItem( KDialog::User1, KStandardGuiItem::clear() );
connect( button( KDialog::User1 ), SIGNAL(clicked()), SLOT(clearView()) );
m_save = button( KDialog::Ok );
QSplitter *splitter = new QSplitter( this );
m_sideBar = new CoverFoundSideBar( m_album, splitter );
KVBox *vbox = new KVBox( splitter );
vbox->setSpacing( 4 );
KHBox *breadcrumbBox = new KHBox( vbox );
QLabel *breadcrumbLabel = new QLabel( i18n( "Finding cover for" ), breadcrumbBox );
AlbumBreadcrumbWidget *breadcrumb = new AlbumBreadcrumbWidget( m_album, breadcrumbBox );
QFont breadcrumbLabelFont;
breadcrumbLabelFont.setBold( true );
breadcrumbLabel->setFont( breadcrumbLabelFont );
breadcrumbLabel->setIndent( 4 );
connect( breadcrumb, SIGNAL(artistClicked(const QString&)), SLOT(addToCustomSearch(const QString&)) );
connect( breadcrumb, SIGNAL(albumClicked(const QString&)), SLOT(addToCustomSearch(const QString&)) );
KHBox *searchBox = new KHBox( vbox );
vbox->setSpacing( 4 );
QStringList completionNames;
QString firstRunQuery( m_album->name() );
completionNames << firstRunQuery;
if( m_album->hasAlbumArtist() )
{
const QString &name = m_album->albumArtist()->name();
completionNames << name;
firstRunQuery += ' ' + name;
}
m_query = firstRunQuery;
m_album->setSuppressImageAutoFetch( true );
m_search = new KComboBox( searchBox );
m_search->setEditable( true ); // creates a KLineEdit for the combobox
m_search->setTrapReturnKey( true );
m_search->setInsertPolicy( QComboBox::NoInsert ); // insertion is handled by us
m_search->setCompletionMode( KGlobalSettings::CompletionPopup );
m_search->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
qobject_cast<KLineEdit*>( m_search->lineEdit() )->setClickMessage( i18n( "Enter Custom Search" ) );
m_search->completionObject()->setOrder( KCompletion::Insertion );
m_search->completionObject()->setIgnoreCase( true );
m_search->completionObject()->setItems( completionNames );
m_search->insertItem( 0, KStandardGuiItem::find().icon(), QString() );
m_search->insertSeparator( 1 );
m_search->insertItem( 2, KIcon("filename-album-amarok"), m_album->name() );
if( m_album->hasAlbumArtist() )
m_search->insertItem( 3, KIcon("filename-artist-amarok"), m_album->albumArtist()->name() );
m_searchButton = new KPushButton( KStandardGuiItem::find(), searchBox );
KPushButton *sourceButton = new KPushButton( KStandardGuiItem::configure(), searchBox );
updateSearchButton( firstRunQuery );
QMenu *sourceMenu = new QMenu( sourceButton );
QAction *lastFmAct = new QAction( i18n( "Last.fm" ), sourceMenu );
QAction *googleAct = new QAction( i18n( "Google" ), sourceMenu );
QAction *yahooAct = new QAction( i18n( "Yahoo!" ), sourceMenu );
QAction *discogsAct = new QAction( i18n( "Discogs" ), sourceMenu );
lastFmAct->setCheckable( true );
googleAct->setCheckable( true );
yahooAct->setCheckable( true );
discogsAct->setCheckable( true );
connect( lastFmAct, SIGNAL(triggered()), this, SLOT(selectLastFm()) );
connect( googleAct, SIGNAL(triggered()), this, SLOT(selectGoogle()) );
connect( yahooAct, SIGNAL(triggered()), this, SLOT(selectYahoo()) );
connect( discogsAct, SIGNAL(triggered()), this, SLOT(selectDiscogs()) );
m_sortAction = new QAction( i18n( "Sort by size" ), sourceMenu );
m_sortAction->setCheckable( true );
connect( m_sortAction, SIGNAL(triggered(bool)), this, SLOT(sortingTriggered(bool)) );
QActionGroup *ag = new QActionGroup( sourceButton );
ag->addAction( lastFmAct );
ag->addAction( googleAct );
ag->addAction( yahooAct );
ag->addAction( discogsAct );
sourceMenu->addActions( ag->actions() );
sourceMenu->addSeparator();
sourceMenu->addAction( m_sortAction );
sourceButton->setMenu( sourceMenu );
//.........这里部分代码省略.........
示例11: appendWidget
void GPConfigDlg::appendWidget(QWidget* parent, CameraWidget* widget)
{
QWidget* newParent = parent;
CameraWidgetType widget_type;
const char* widget_name;
const char* widget_info;
const char* widget_label;
float widget_value_float;
int widget_value_int;
const char* widget_value_string;
gp_widget_get_type(widget, &widget_type);
gp_widget_get_label(widget, &widget_label);
gp_widget_get_info(widget, &widget_info);
gp_widget_get_name(widget, &widget_name);
// gphoto2 doesn't seem to have any standard for i18n
QString whats_this = QString::fromLocal8Bit(widget_info);
// Add this widget to parent
switch (widget_type)
{
case GP_WIDGET_WINDOW:
{
setCaption(widget_label);
break;
}
case GP_WIDGET_SECTION:
{
if (!d->tabWidget)
{
d->tabWidget = new QTabWidget(parent);
parent->layout()->addWidget(d->tabWidget);
}
QWidget* tab = new QWidget(d->tabWidget);
// widgets are to be aligned vertically in the tab
QVBoxLayout* tabLayout = new QVBoxLayout(tab, marginHint(),
spacingHint());
d->tabWidget->insertTab(tab, widget_label);
KVBox* tabContainer = new KVBox(tab);
tabContainer->setSpacing(spacingHint());
tabLayout->addWidget(tabContainer);
newParent = tabContainer;
tabLayout->addStretch();
break;
}
case GP_WIDGET_TEXT:
{
gp_widget_get_value(widget, &widget_value_string);
Q3Grid* grid = new Q3Grid(2, Qt::Horizontal, parent);
parent->layout()->addWidget(grid);
grid->setSpacing(spacingHint());
new QLabel(QString::fromLocal8Bit(widget_label) + ':', grid);
QLineEdit* lineEdit = new QLineEdit(widget_value_string, grid);
d->wmap.insert(widget, lineEdit);
if (!whats_this.isEmpty())
{
grid->setWhatsThis(whats_this);
}
break;
}
case GP_WIDGET_RANGE:
{
float widget_low;
float widget_high;
float widget_increment;
gp_widget_get_range(widget, &widget_low, &widget_high, &widget_increment);
gp_widget_get_value(widget, &widget_value_float);
Q3GroupBox* groupBox = new Q3GroupBox(1, Qt::Horizontal, widget_label, parent);
parent->layout()->addWidget(groupBox);
QSlider* slider = new QSlider(
(int)widget_low,
(int)widget_high,
(int)widget_increment,
(int)widget_value_float,
Qt::Horizontal,
groupBox);
d->wmap.insert(widget, slider);
if (!whats_this.isEmpty())
{
groupBox->setWhatsThis(whats_this);
}
break;
}
case GP_WIDGET_TOGGLE:
{
//.........这里部分代码省略.........
示例12: KDialog
DeviceConfigureDialog::DeviceConfigureDialog( MediaDevice *device )
: KDialog( Amarok::mainWindow() )
, m_device( device )
{
setCaption( i18n("Select Plugin for %1", m_device->name() ) );
setModal( true );
setButtons( Ok | Cancel );
showButtonSeparator( true );
kapp->setTopWidget( this );
setCaption( KDialog::makeStandardCaption( i18n( "Configure Media Device" ) ) );
showButton( KDialog::Apply, false );
KVBox* vbox = new KVBox( this );
setMainWidget( vbox );
vbox->setSpacing( KDialog::spacingHint() );
QLabel *connectLabel = 0;
m_connectEdit = 0;
QLabel *disconnectLabel = 0;
m_disconnectEdit = 0;
m_transcodeCheck = 0;
Q3ButtonGroup *transcodeGroup = 0;
m_transcodeAlways = 0;
m_transcodeWhenNecessary = 0;
m_transcodeRemove = 0;
if( device )
{
device->loadConfig();
// pre-connect/post-disconnect (mount/umount)
connectLabel = new QLabel( vbox );
connectLabel->setText( i18n( "Pre-&connect command:" ) );
m_connectEdit = new HintLineEdit( device->m_preconnectcmd, vbox );
m_connectEdit->setHint( i18n( "Example: mount %d" ) );
connectLabel->setBuddy( m_connectEdit );
m_connectEdit->setToolTip( i18n( "Set a command to be run before connecting to your device (e.g. a mount command) here.\n%d is replaced by the device node, %m by the mount point.\nEmpty commands are not executed." ) );
disconnectLabel = new QLabel( vbox );
disconnectLabel->setText( i18n( "Post-&disconnect command:" ) );
m_disconnectEdit = new HintLineEdit( device->m_postdisconnectcmd, vbox );
disconnectLabel->setBuddy( m_disconnectEdit );
m_disconnectEdit->setHint( i18n( "Example: eject %d" ) );
m_disconnectEdit->setToolTip( i18n( "Set a command to be run after disconnecting from your device (e.g. an eject command) here.\n%d is replaced by the device node, %m by the mount point.\nEmpty commands are not executed." ) );
// transcode
m_transcodeCheck = new QCheckBox( vbox );
m_transcodeCheck->setText( i18n( "&Transcode before transferring to device" ) );
m_transcodeCheck->setChecked( device->m_transcode );
transcodeGroup = new Q3VButtonGroup( vbox );
QString format = "mp3";
if( !device->supportedFiletypes().isEmpty() )
format = device->supportedFiletypes().first();
transcodeGroup->setTitle( i18n( "Transcode to preferred format (%1) for device", format ) );
m_transcodeAlways = new QRadioButton( transcodeGroup );
m_transcodeAlways->setText( i18n( "Whenever possible" ) );
m_transcodeAlways->setChecked( device->m_transcodeAlways );
m_transcodeWhenNecessary = new QRadioButton( transcodeGroup );
m_transcodeWhenNecessary->setText( i18n( "When necessary" ) );
m_transcodeWhenNecessary->setChecked( !device->m_transcodeAlways );
connect( m_transcodeCheck, SIGNAL(toggled(bool)),
transcodeGroup, SLOT(setEnabled(bool)) );
transcodeGroup->insert( m_transcodeAlways );
transcodeGroup->insert( m_transcodeWhenNecessary );
m_transcodeRemove = new QCheckBox( transcodeGroup );
m_transcodeRemove->setText( i18n( "Remove transcoded files after transfer" ) );
m_transcodeRemove->setChecked( device->m_transcodeRemove );
const ScriptManager *sm = ScriptManager::instance();
m_transcodeCheck->setEnabled( !sm->transcodeScriptRunning().isEmpty() );
transcodeGroup->setEnabled( !sm->transcodeScriptRunning().isEmpty() && device->m_transcode );
if( sm->transcodeScriptRunning().isNull() )
{
m_transcodeCheck->setToolTip( i18n( "For this feature, a script of type \"Transcode\" has to be running" ) );
transcodeGroup->setToolTip( i18n( "For this feature, a script of type \"Transcode\" has to be running" ) );
}
device->addConfigElements( vbox );
}
m_accepted = false;
}