PoiskmPluginGetTunesDialog::Private::Private() : QObject()
{
	item = QompQmlEngine::instance()->createItem(QUrl("qrc:///qml/PoiskmResultView.qml"));
	connect(item, SIGNAL(itemCheckClick(QVariant)), SLOT(itemClicked(QVariant)));
	connect(item, SIGNAL(actNext()), SIGNAL(next()));
	connect(item, SIGNAL(selectAllClicked(QVariant)), SLOT(selectAllClicked(QVariant)));
}
OpenPlanDialog::OpenPlanDialog(QWidget *parent, const char *name, bool modal, WFlags f):OpenPlanDialogBase(parent, name, modal, f)
{
	setPlanTable();
	
	connect(planTable, SIGNAL(clicked(int, int, int, const QPoint&)), this, SLOT(selectOne(int, int)));
	connect(planTable, SIGNAL(clicked(int, int, int, const QPoint&)), this, SLOT(enableOpenButton()));
	connect(resetAllButton, SIGNAL(clicked()), this, SLOT(resetAllClicked()));
	connect(selectAllButton, SIGNAL(clicked()), this, SLOT(selectAllClicked()));
}
ExportInfoPage::ExportInfoPage(const QMap<QString, QString> &str, QWidget *parent)
    : QWizardPage(parent), strMap(str)
{
    setTitle(tr("Source Information"));
    setSubTitle(tr("Specify source information about the source type for which you "
                   "want to export."));

    sourceDatabaseLabel = new QLabel(tr("Source Database:"));
    sourceDatabaseComcoBox = new QComboBox;
//    sourceTableLabel = new QLabel(tr("Source Table:"));
//    sourceTableComcoBox = new QComboBox;
    listView = new QListView;
    model = new MyStringListModel;
    listView->setModel(model);
    selectAllButton = new QPushButton(tr("Select All"));
    unSelectAllButton = new QPushButton(tr("Unselect All"));

    QHBoxLayout *topLayout = new QHBoxLayout;
    topLayout->addWidget(sourceDatabaseLabel);
    topLayout->addWidget(sourceDatabaseComcoBox);
    topLayout->addStretch();

    QVBoxLayout *rightLayout = new QVBoxLayout;
    rightLayout->addWidget(selectAllButton);
    rightLayout->addWidget(unSelectAllButton);
    rightLayout->addStretch();

    QHBoxLayout *bottomLayout = new QHBoxLayout;
    bottomLayout->addWidget(listView);
    bottomLayout->addLayout(rightLayout);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addLayout(topLayout);
    mainLayout->addLayout(bottomLayout);

    setLayout(mainLayout);

    connect(selectAllButton, SIGNAL(clicked()), this, SLOT(selectAllClicked()));
    connect(unSelectAllButton, SIGNAL(clicked()), this, SLOT(unselectAllClicked()));
    connect(sourceDatabaseComcoBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(databaseChanged(QString)));
    sourceDatabaseComcoBox->addItems(str.keys());
//    sourceDatabaseComcoBox->setCurrentIndex(-1);
//    sourceTableComcoBox->setCurrentIndex(-1);

//    registerField("sourceName*", sourceDatabaseComcoBox);
}
Example #4
0
DirOpener::DirOpener( Config *_config, Mode _mode, QWidget *parent, Qt::WFlags f )
    : KDialog( parent, f ),
    dialogAborted( false ),
    config( _config ),
    mode( _mode )
{
    setCaption( i18n("Add folder") );
    setWindowIcon( KIcon("folder") );

    if( mode == Convert )
    {
        setButtons( KDialog::User1 | KDialog::Cancel );
    }
    else if( mode == ReplayGain )
    {
        setButtons( KDialog::Ok | KDialog::Cancel );
    }

    setButtonText( KDialog::User1, i18n("Proceed") );
    setButtonIcon( KDialog::User1, KIcon("go-next") );

    const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height();

    connect( this, SIGNAL(user1Clicked()), this, SLOT(proceedClicked()) );
    connect( this, SIGNAL(okClicked()), this, SLOT(addClicked()) );

    page = DirOpenPage;

    QWidget *widget = new QWidget();
    QGridLayout *mainGrid = new QGridLayout( widget );
    QGridLayout *topGrid = new QGridLayout();
    mainGrid->addLayout( topGrid, 0, 0 );
    setMainWidget( widget );

    lSelector = new QLabel( i18n("1. Select directory"), widget );
    QFont font;
    font.setBold( true );
    lSelector->setFont( font );
    topGrid->addWidget( lSelector, 0, 0 );
    lOptions = new QLabel( i18n("2. Set conversion options"), widget );
    topGrid->addWidget( lOptions, 0, 1 );

    // draw a horizontal line
    QFrame *lineFrame = new QFrame( widget );
    lineFrame->setFrameShape( QFrame::HLine );
    lineFrame->setFrameShadow( QFrame::Sunken );
    mainGrid->addWidget( lineFrame, 1, 0 );

    if( mode == ReplayGain )
    {
        lSelector->hide();
        lOptions->hide();
        lineFrame->hide();
    }

    // Dir Opener Widget

    dirOpenerWidget = new QWidget( widget );
    mainGrid->addWidget( dirOpenerWidget, 2, 0 );

    QVBoxLayout *box = new QVBoxLayout( dirOpenerWidget );

    QHBoxLayout *directoryBox = new QHBoxLayout();
    box->addLayout( directoryBox );

    QLabel *labelFilter = new QLabel( i18n("Directory:"), dirOpenerWidget );
    directoryBox->addWidget( labelFilter );

    uDirectory = new KUrlRequester( KUrl("kfiledialog:///soundkonverter-add-media"), dirOpenerWidget );
    uDirectory->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly );
    directoryBox->addWidget( uDirectory );

    QLabel *labelDirectory = new QLabel( i18n("Only add selected file formats:"), dirOpenerWidget );
    box->addWidget( labelDirectory );

    QHBoxLayout *fileTypesBox = new QHBoxLayout();
    box->addLayout( fileTypesBox );

    QStringList codecList;
    fileTypes = new KListWidget( dirOpenerWidget );
    if( mode == Convert )
    {
        codecList = config->pluginLoader()->formatList( PluginLoader::Decode, PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) );
    }
    else if( mode == ReplayGain )
    {
        codecList = config->pluginLoader()->formatList( PluginLoader::ReplayGain, PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) );
    }
    for( int i = 0; i < codecList.size(); i++ )
    {
        if( codecList.at(i) == "audio cd" ) continue;
        QListWidgetItem *newItem = new QListWidgetItem( codecList.at(i), fileTypes );
        newItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable );
        newItem->setCheckState( Qt::Checked );
    }

    QVBoxLayout *fileTypesFormatsBox = new QVBoxLayout();
    fileTypesBox->addLayout( fileTypesFormatsBox );

    fileTypesFormatsBox->addWidget( fileTypes );
    QLabel *formatHelp = new QLabel( "<a href=\"format-help\">" + i18n("Are you missing some file formats?") + "</a>", this );
    connect( formatHelp, SIGNAL(linkActivated(const QString&)), this, SLOT(showHelp()) );
    fileTypesFormatsBox->addWidget( formatHelp );

    QVBoxLayout *fileTypesButtonsBox = new QVBoxLayout();
    fileTypesBox->addLayout( fileTypesButtonsBox );
    fileTypesButtonsBox->addStretch();

    pSelectAll = new KPushButton( KIcon("edit-select-all"), i18n("Select all"), dirOpenerWidget );
    fileTypesButtonsBox->addWidget( pSelectAll );
    connect( pSelectAll, SIGNAL(clicked()), this, SLOT(selectAllClicked()) );

    pSelectNone = new KPushButton( KIcon("application-x-zerosize"), i18n("Select none"), dirOpenerWidget );
    fileTypesButtonsBox->addWidget( pSelectNone );
    connect( pSelectNone, SIGNAL(clicked()), this, SLOT(selectNoneClicked()) );

    cRecursive = new QCheckBox( i18n("Recursive"), dirOpenerWidget );
    cRecursive->setChecked( true );
    cRecursive->setToolTip( i18n("If checked, files from subdirectories will be added, too.") );
    fileTypesButtonsBox->addWidget( cRecursive );

    fileTypesButtonsBox->addStretch();


    // Conversion Options Widget

    options = new Options( config, i18n("Select your desired output options and click on \"Ok\"."), widget );
    mainGrid->addWidget( options, 2, 0 );
    adjustSize();
    options->hide();


    const KUrl url = KFileDialog::getExistingDirectoryUrl( uDirectory->url(), this );
    if( !url.isEmpty() )
        uDirectory->setUrl( url );
    else
        dialogAborted = true;

        // Prevent the dialog from beeing too wide because of the directory history
    if( parent && width() > parent->width() )
        setInitialSize( QSize(parent->width()-fontHeight,sizeHint().height()) );
    KSharedConfig::Ptr conf = KGlobal::config();
    KConfigGroup group = conf->group( "DirOpener" );
    restoreDialogSize( group );
}
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();
}
RegisteredUsersDialog::RegisteredUsersDialog(QWidget * par)
: QWidget(par)
{
	g_pRegisteredUsersDialog = this;

	g_pLocalRegisteredUserDataBase = new KviRegisteredUserDataBase();
	g_pLocalRegisteredUserDataBase->copyFrom(g_pRegisteredUserDataBase);

	setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::RegUsers)));
	setWindowTitle(__tr2qs_ctx("Registered Users - KVIrc","register"));

	QGridLayout * g = new QGridLayout(this);


	m_pListView = new KviRegisteredUsersListView(this);
	m_pListView->setItemDelegate(new RegisteredUsersDialogItemDelegate());

	connect(m_pListView,SIGNAL(itemPressed(QTreeWidgetItem *,int)),this,SLOT(itemPressed(QTreeWidgetItem *,int)));
	connect(m_pListView,SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),this,SLOT(itemDoubleClicked(QTreeWidgetItem *, int)));

	g->addWidget(m_pListView,0,0,2,2);

	KviTalVBox * vbox = new KviTalVBox(this);
	vbox->setSpacing(4);
	g->addWidget(vbox,0,2);

	m_pWizardAddButton = new QPushButton(__tr2qs_ctx("Add (Wizard)...","register"),vbox);
	connect(m_pWizardAddButton,SIGNAL(clicked()),this,SLOT(addWizardClicked()));
	m_pWizardAddButton->setToolTip(__tr2qs_ctx("Add a registered user by means of a user-friendly wizard.","register"));
	m_pWizardAddButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::NewItemByWizard)));


	m_pAddButton = new QPushButton(__tr2qs_ctx("&Add...","register"),vbox);
	connect(m_pAddButton,SIGNAL(clicked()),this,SLOT(addClicked()));
	m_pAddButton->setToolTip(__tr2qs_ctx("Open the edit dialog to create a new user entry.","register"));
	m_pAddButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::NewItem)));

	m_pAddGroupButton = new QPushButton(__tr2qs_ctx("&Add Group...","register"),vbox);
	connect(m_pAddGroupButton,SIGNAL(clicked()),this,SLOT(addGroupClicked()));
	m_pAddGroupButton->setToolTip(__tr2qs_ctx("Adds a new group","register"));
	m_pAddGroupButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::NewItem)));

	m_pRemoveButton = new QPushButton(__tr2qs_ctx("Re&move","register"),vbox);
	connect(m_pRemoveButton,SIGNAL(clicked()),this,SLOT(removeClicked()));
	m_pRemoveButton->setEnabled(false);
	m_pRemoveButton->setToolTip(__tr2qs_ctx("Remove the currently selected entries.","register"));
	m_pRemoveButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::DeleteItem)));


	m_pEditButton = new QPushButton(__tr2qs_ctx("&Edit...","register"),vbox);
	connect(m_pEditButton,SIGNAL(clicked()),this,SLOT(editClicked()));
	m_pEditButton->setEnabled(false);
	m_pEditButton->setToolTip(__tr2qs_ctx("Edit the first selected entry.","register"));
	m_pEditButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::EditItem)));

	QFrame * f = new QFrame(vbox);
	f->setFrameStyle(QFrame::HLine | QFrame::Sunken);

	m_pSelectAllButton = new QPushButton(__tr2qs_ctx("Select all","register"),vbox);
	connect(m_pSelectAllButton,SIGNAL(clicked()),this,SLOT(selectAllClicked()));
	m_pSelectAllButton->setToolTip(__tr2qs_ctx("Select all the entries","register"));
	m_pSelectAllButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Plus)));

	m_pExportButton = new QPushButton(__tr2qs_ctx("Export To...","register"),vbox);
	m_pExportButton->setEnabled(false);
	connect(m_pExportButton,SIGNAL(clicked()),this,SLOT(exportClicked()));
	m_pExportButton->setToolTip(__tr2qs_ctx("Export the selected entries to a file.<br>All the data associated with the selected registered users will be exported.<br>You (or anyone else) can later import the entries by using the \"Import\" button.","register"));
	m_pExportButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Floppy)));


	m_pImportButton = new QPushButton(__tr2qs_ctx("Import From...","register"),vbox);
	connect(m_pImportButton,SIGNAL(clicked()),this,SLOT(importClicked()));
	m_pImportButton->setToolTip(__tr2qs_ctx("Import entries from a file exported earlier by the \"export\" function of this dialog.","register"));
	m_pImportButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Folder)));


	KviTalHBox * hbox = new KviTalHBox(this);
	hbox->setSpacing(4);
	g->addWidget(hbox,3,1,1,2);

	QPushButton * b;


	b = new QPushButton(__tr2qs_ctx("&OK","register"),hbox);
	connect(b,SIGNAL(clicked()),this,SLOT(okClicked()));
	b->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Accept)));
	//b->setMinimumWidth(120);

	b = new QPushButton(__tr2qs_ctx("Cancel","register"),hbox);
	connect(b,SIGNAL(clicked()),this,SLOT(cancelClicked()));
	b->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Discard)));
	//b->setMinimumWidth(120);

	g->addItem(new QSpacerItem(0, 15), 2, 0);
	g->setColumnStretch(0,1);
	g->setRowStretch(1,1);

	connect(m_pListView,SIGNAL(itemSelectionChanged()),this,SLOT(selectionChanged()));
	connect(m_pListView,SIGNAL(rightButtonPressed(QTreeWidgetItem *, QPoint)),this,SLOT(rightButtonPressed(QTreeWidgetItem *, QPoint)));

	new QShortcut(Qt::Key_Escape, this, SLOT(cancelClicked()));

	fillList();

	if(!parent())
	{
		if(KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).y() < 5)
			KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).setY(5);

		//setGeometry(KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry));
		resize(KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).width(),
			KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).height());

		QRect rect = g_pApp->desktop()->screenGeometry(g_pMainWindow);
		move(rect.x() + ((rect.width() - KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).width())/2),rect.y() + ((rect.height() - KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).height())/2));

	}
}