Exemplo n.º 1
0
ExportDialog::ExportDialog(QWidget * parent)
        : KDialog(parent),m_outputStream(0)
{
    kDebug() << "ExportDialog::ExportDialog";
    setButtons(Help | User1 | Cancel);
    kDebug() << "ExportDialog: setButtons";
    ui.setupUi(mainWidget());
    kDebug() << "ExportDialog: ui.setupUi(mainWidget());";
    setButtonGuiItem(User1, KGuiItem(i18n("OK")));
    kDebug() << "ExportDialog: setButtonGuiItem(User1, KGuiItem(i18n(\"OK\")));";
    ui.targetFile->setMode(KFile::File | KFile::Directory | KFile::LocalOnly);
    kDebug() << "ui.targetFile->setMode(KFile::File | KFile::Directory | KFile::LocalOnly);";

    setCaption(i18n("Export Chemical Data"));
    kDebug() << "ui.targetFile->setMode(KFile::File | KFile::Directory | KFile::LocalOnly);";

    populateElementList();
    kDebug() << "ui.targetFile->setMode(KFile::File | KFile::Directory | KFile::LocalOnly);";

    ui.formatList->addItem(".html (formatted html document)", "html");
    ui.formatList->addItem(".xml (raw element data)", "xml");
    ui.formatList->addItem(".csv (comma-separated data)", "csv");
    kDebug() << "ui.formatList->addItem(...);";

    connect(this, SIGNAL(user1Clicked()), this, SLOT(slotOkClicked()));
    kDebug() << "connect(this, SIGNAL(user1Clicked()), this, SLOT(slotOkClicked()));";
    setHelp(QString(),"kalzium");
    kDebug() << "setHelp(QString(),\"kalzium\");";
}
Exemplo n.º 2
0
GroupRequestDlg::GroupRequestDlg(const ShareQQMsgPtr msg, Contact *contact, Group *group, QWidget *parent) : QDialog(parent),
    ui_(new Ui::GroupRequestDlg)
{
	assert(group);

    ui_->setupUi(this);

	QQSystemGMsg *sysg_msg = (QQSystemGMsg *)msg.data();
    QString name;

    if (contact)
    {
        name = contact->name();
    }
    else
    {
        
		name = sysg_msg->talkTo();
    }
    ui_->lbl_request_name_->setText(name);
    ui_->lbl_group_name_->setText(group->name());

	if ( contact )
	{
		ui_->lbl_avatar_->setPixmap(contact->icon());
	}
    ui_->pte_msg_->appendPlainText(msg->msg());

    gid_ = msg->talkTo();
    id_ = msg->sendUin();

    connect(ui_->pb_ok_ , SIGNAL(clicked()), this, SLOT(slotOkClicked()));
    connect(ui_->pb_ignore_ , SIGNAL(clicked()), this, SLOT(slotIgnoreClicked()));
    connect(ui_->rb_deny_, SIGNAL(toggled(bool)), this, SLOT(slotToggleDenyReason(bool)));
}
Exemplo n.º 3
0
bool EvaQunSysMsgWindow::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: slotQQClicked(); break;
    case 1: slotQunClicked(); break;
    case 2: slotOkClicked(); break;
    case 3: slotRejectClicked(); break;
    case 4: slotJoinQunAuthReply((const unsigned int)(*((const unsigned int*)static_QUType_ptr.get(_o+1))),(const unsigned char)(*((const unsigned char*)static_QUType_ptr.get(_o+2)))); break;
    default:
	return EvaQunSysMsgUIBase::qt_invoke( _id, _o );
    }
    return TRUE;
}
Exemplo n.º 4
0
bool EvaAddingNoticeWindow::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: slotFaceClicked(); break;
    case 1: slotOkClicked(); break;
    case 2: processAddingRequest(); break;
    case 3: slotAddAuthActionReply((const unsigned int)(*((const unsigned int*)static_QUType_ptr.get(_o+1))),(const unsigned char)(*((const unsigned char*)static_QUType_ptr.get(_o+2))),(const bool)static_QUType_bool.get(_o+3)); break;
    case 4: slotRejectClicked(); break;
    default:
	return EvaAddingNoticeUIBase::qt_invoke( _id, _o );
    }
    return TRUE;
}
Exemplo n.º 5
0
void AbstractConfig::showOkButton(bool show)
{
#if !defined(MOBILE_UI)
    if (show) {
        if (!m_okButton) {
            m_okButton = new StyledButtonItem(tr("ok"), font(), this);
            connect(m_okButton, SIGNAL(clicked()), this, SLOT(slotOkClicked()));
            layoutButtons();
        }
        m_okButton->show();
    } else if (m_okButton)
        m_okButton->hide();
#endif
}
Exemplo n.º 6
0
Setup::Setup(QWidget* const parent)
  : KPageDialog(parent), d(new Private())
{
    setCaption(i18n("Configure"));
    setButtons(Apply|Ok|Cancel);
    setDefaultButton(Ok);
    setModal(true);

    d->setupGeneral = new SetupGeneral(this);
    d->pageGeneral = addPage(d->setupGeneral, i18nc("General setup", "General"));

    connect(this, SIGNAL(applyClicked()),
            this, SLOT(slotApplyClicked()));

    connect(this, SIGNAL(okClicked()),
            this, SLOT(slotOkClicked()));
}
Exemplo n.º 7
0
void EvaAddingNoticeWindow::init()
{
	m_ID = 0;
	m_Type = 0;
	m_Message = "";
	m_AllowReverse = true;
	m_HasVerified = false;

	TQPixmap *facePic = EvaMain::images->getFaceByID( 0 );
	if(facePic){
		TQIconSet faceIcon;
		faceIcon.setPixmap(*facePic,TQIconSet::Large);
		tbFace->setIconSet(faceIcon);
	}

	lblMessageTag->setHidden(true);
	lblMessage->setHidden(true);
	btngrpActions->setHidden(true);
	fraRejectContents->setHidden(true);
	tbtnAuthSettings->setHidden(true);
	adjustSize();

	TQObject::connect(EvaMain::g_AddingManager, SIGNAL(addAuthActionReply(const unsigned int, const unsigned char, const bool)),
						SLOT(slotAddAuthActionReply(const unsigned int, const unsigned char, const bool)));
	
	TQObject::connect(m_PacketManager, SIGNAL(receivedVerifyAddingMessageReply(const unsigned int,
										const unsigned char,
										const unsigned char,
										const unsigned char)),
				EvaMain::g_AddingManager,
					SLOT(slotReceivedVerifyAddingMessageReply(const unsigned int,
										const unsigned char,
										const unsigned char,
										const unsigned char)));
	//NOTE: VerifyAddingMessageReply is useless. It just means your verify message has been received by host
	//      Verify message is sent whenever you got a adding request like a kind of reply message
	
	TQObject::connect(tbFace, SIGNAL(clicked()), SLOT(slotFaceClicked()));
	TQObject::connect(btnOk, SIGNAL(clicked()), SLOT(slotOkClicked()));
	TQObject::connect(btnCancel, SIGNAL(clicked()), SLOT(close()));
	TQObject::connect(rbtnAcceptAdd, SIGNAL(clicked()), SLOT(slotRejectClicked( )));
	TQObject::connect(rbtnAccept, SIGNAL(clicked()), SLOT(slotRejectClicked( )));
	TQObject::connect(rbtnReject, SIGNAL(clicked()), SLOT(slotRejectClicked( )));
	
}
Exemplo n.º 8
0
KImportDlg::KImportDlg(QWidget *parent)
    : KImportDlgDecl(parent)
{
  setModal(true);
  // Set all the last used options
  readConfig();

  loadProfiles(true);

  // load button icons
  m_qbuttonCancel->setGuiItem(KStandardGuiItem::cancel());

  KGuiItem okButtenItem(i18n("&Import"),
                        KIcon("document-import"),
                        i18n("Start operation"),
                        i18n("Use this to start the import operation"));
  m_qbuttonOk->setGuiItem(okButtenItem);

  KGuiItem browseButtenItem(i18n("&Browse..."),
                            KIcon("document-open"),
                            i18n("Select filename"),
                            i18n("Use this to select a filename to export to"));
  m_qbuttonBrowse->setGuiItem(browseButtenItem);

  KGuiItem newButtenItem(i18nc("New profile", "&New..."),
                         KIcon("document-new"),
                         i18n("Create a new profile"),
                         i18n("Use this to open the profile editor"));
  m_profileEditorButton->setGuiItem(newButtenItem);

  // connect the buttons to their functionality
  connect(m_qbuttonBrowse, SIGNAL(clicked()), this, SLOT(slotBrowse()));
  connect(m_qbuttonOk, SIGNAL(clicked()), this, SLOT(slotOkClicked()));
  connect(m_qbuttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
  connect(m_profileEditorButton, SIGNAL(clicked()), this, SLOT(slotNewProfile()));

  // connect the change signals to the check slot and perform initial check
  connect(m_qlineeditFile, SIGNAL(textChanged(QString)), this,
          SLOT(slotFileTextChanged(QString)));

  // setup button enable status
  slotFileTextChanged(m_qlineeditFile->text());
}
Exemplo n.º 9
0
AddDialog::AddDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AddDialog),
    mRoot{nullptr},
    mNewItem{nullptr},
    mParent{nullptr}
{
    ui->setupUi(this);
    setWindowTitle("Add...");

    ui->typeComboBox->addItem("Menu Item", MenuItemType);
    ui->typeComboBox->addItem("Menu", MenuType);

    connect(ui->backPushButton, SIGNAL(clicked(bool)), this, SLOT(slotBackClicked()), Qt::UniqueConnection);
    connect(ui->cancelPushButton_2, SIGNAL(clicked(bool)), this, SLOT(slotCancelClicked()), Qt::UniqueConnection);
    connect(ui->nextPushButton, SIGNAL(clicked(bool)), this, SLOT(slotNextClicked()), Qt::UniqueConnection);
    connect(ui->okPushButton, SIGNAL(clicked(bool)), this, SLOT(slotOkClicked()), Qt::UniqueConnection);
    connect(ui->widget, SIGNAL(itemChanged()), this, SLOT(slotChanged()), Qt::UniqueConnection);
}
Exemplo n.º 10
0
AddAlternatives::AddAlternatives(Item* item, QWidget *parent)
	: KDialog(parent), m_item(item), m_alternative(0)
{
	setupUi(mainWidget());
	mainWidget()->layout()->setMargin(0);
	
	setButtons(Ok | Cancel);
	setCaption(i18n("Add Alternative"));
	showButtonSeparator(true);
	
	m_Path->setWindowTitle( i18n( "Choose Alternative" ) );
	m_Path->setFilter( i18n( "*|All Files" ) );
	m_Path->setMode( KFile::File | KFile::LocalOnly );
	
	const int slaveCount = item->getSlaves()->count();
	if (slaveCount > 0)
	{
		SlaveList *slaves = item->getSlaves();
		
		QWidget *w = new QWidget;
		QVBoxLayout *lay = new QVBoxLayout(w);
		for (int i = 0; i < slaveCount; ++i)
		{
			if (i > 0)
				lay->addWidget(new KSeparator(Qt::Horizontal, w));
			SlaveWidget *sw = new SlaveWidget(slaves->at(i), w);
			lay->addWidget(sw);
			m_slaveWidgets.append(sw);
			connect(sw, SIGNAL(slaveChanged(QString)), this, SLOT(slotCheckSlaves()));
		}
		w->show();
		m_slavesArea->setWidget(w);
	}
	else
	{
		m_slavesGroup->hide();
	}
	
	enableButtonOk(false);
	connect(m_Path, SIGNAL(textChanged(QString)), this, SLOT(slotCheckSlaves()));
	connect(this, SIGNAL(okClicked()), this, SLOT(slotOkClicked()));
}
Exemplo n.º 11
0
EvaQunSysMsgWindow::EvaQunSysMsgWindow( EvaPacketManager * packetManager )
	: m_PacketManager(packetManager)
{
	bgActions->setHidden(true);
	fraMessage->setHidden(true);
	chbRejectForever->setHidden(true);
	btnOk->setHidden(true);

	TQObject::connect(tbQQ, SIGNAL(clicked()), SLOT(slotTQQClicked()));
	TQObject::connect(tbQun, SIGNAL(clicked()), SLOT(slotQunClicked()));

	TQObject::connect(rbtnAccept, SIGNAL(clicked()), SLOT(slotRejectClicked( )));
	TQObject::connect(rbtnReject, SIGNAL(clicked()), SLOT(slotRejectClicked( )));

	TQObject::connect(btnOk, SIGNAL(clicked()), SLOT(slotOkClicked()));
	TQObject::connect(btnClose, SIGNAL(clicked()), SLOT(close()));

	TQObject::connect(EvaMain::g_AddingManager, SIGNAL(joinQunAuthReply(const unsigned int, const unsigned char)),
					SLOT(slotJoinQunAuthReply(const unsigned int, const unsigned char)));
	adjustSize();
}
Exemplo n.º 12
0
YandexFotkiAlbumDialog::YandexFotkiAlbumDialog(QWidget* const parent, YandexFotkiAlbum& album)
    : KPNewAlbumDialog(parent, QStringLiteral("Yandex.Fotki")),
      m_album(album)
{
    hideLocation();
    hideDateTime();

    QGroupBox* const albumBox = new QGroupBox(QString(), this);

    m_passwordEdit = new QLineEdit();
    m_passwordEdit->setWhatsThis(i18n("Password for the album (optional)."));

    QFormLayout* const albumBoxLayout  = new QFormLayout;
    albumBoxLayout->addRow(i18n("Password:"), m_passwordEdit);

    albumBox->setLayout(albumBoxLayout);
    addToMainLayout(albumBox);
    
    connect(getButtonBox(), SIGNAL(accepted()),
            this, SLOT(slotOkClicked()));
}
Exemplo n.º 13
0
WTSConfigurationPage::WTSConfigurationPage( ReportDialog* parent )
    : ReportConfigurationPage( parent )
    , m_ui( new Ui::WeeklyTimeSheetConfigurationPage )
{
    m_ui->setupUi( this );

    connect( m_ui->pushButtonBack, SIGNAL( clicked() ),
             SIGNAL( back() ) );
    connect( m_ui->pushButtonReport, SIGNAL( clicked() ),
             SLOT( slotOkClicked() ) );
    connect( m_ui->comboBoxWeek, SIGNAL( currentIndexChanged( int ) ),
             SLOT( slotWeekComboItemSelected( int ) ) );
    connect( m_ui->toolButtonSelectTask, SIGNAL( clicked() ),
             SLOT( slotSelectTask() ) );
    connect( m_ui->checkBoxSubTasksOnly, SIGNAL( toggled( bool ) ),
             SLOT( slotCheckboxSubtasksOnlyChecked( bool ) ) );
    m_ui->comboBoxWeek->setCurrentIndex( 1 );
    slotCheckboxSubtasksOnlyChecked( m_ui->checkBoxSubTasksOnly->isChecked() );

    new DateEntrySyncer( m_ui->spinBoxWeek, m_ui->spinBoxYear, m_ui->dateEditDay, 1, this );

    QTimer::singleShot( 0, this, SLOT( slotDelayedInitialization() ) );
}
Exemplo n.º 14
0
QubanWizard::QubanWizard(QWidget* parent)
    : QDialog(parent)
{
	setupUi(this);

	config = Configuration::getConfig();

	prefGeneral = new PrefGeneral(generalFrame);
    generalLayout->addWidget(prefGeneral);
	prefUnpack = new PrefUnpack(unpackFrame);
    unpackLayout2->addWidget(prefUnpack);

	fromCheck->setChecked(config->showFrom);
	detailsCheck->setChecked(config->showDetails);
	dateCheck->setChecked(config->showDate);
	sortCheck->setChecked(config->rememberSort);
	sizeCheck->setChecked(config->rememberWidth);
	compressedCheck->setChecked(config->downloadCompressed);
    groupingSizeSpinBox->setValue(config->groupCheckCount);

    deleteBtn->setChecked(config->deleteFailed);
    keepBtn->setChecked(!config->deleteFailed);
    overwriteBtn->setChecked(config->overwriteExisting);
    renameBtn->setChecked(!config->overwriteExisting);

    if (config->singleViewTab)
    {
            oneTabBtn->setChecked(true);
            askBtn->setEnabled(false);
    }
    else
            multiTabBtn->setChecked(true);

    if (config->dViewed == Configuration::Ask)
    {
            if (!config->singleViewTab)
                    askBtn_2->setChecked(true);
            else
                    keepBtn_2->setChecked(true);
    }
    else if (config->dViewed == Configuration::No)
            keepBtn_2->setChecked(true);
    else
            deleteBtn_2->setChecked(true);

    textFileSuffixes->setText(config->textSuffixes);

    activateBtn->setChecked(config->activateTab);

    statusBtn->setChecked(config->showStatusBar);

	if (config->markOpt == Configuration::Ask)
		askBtn->setChecked(true);
	else if (config->markOpt == Configuration::No)
		nullBtn->setChecked(true);
	else markBtn->setChecked(true);

	if (config->checkDaysValue)
	{
		checkDaysValue->setValue(config->checkDaysValue);
		checkHeadersCheck->setChecked(config->checkDaysValue);
	}

    bulkLoadValue->setValue(config->bulkLoadThreshold);
    bulkDeleteValue->setValue(config->bulkDeleteThreshold);

	connect(okButton, SIGNAL(clicked()), this, SLOT(slotOkClicked()));
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(slotCancelClicked()));
	connect(addServerButton, SIGNAL(clicked()), this, SIGNAL(newServer()));
	connect(getGroupListButton, SIGNAL(clicked()), this, SIGNAL(sigGetGroups()));

	connect(checkHeadersCheck, SIGNAL(toggled(bool)), this, SLOT(slotToggleDay(bool)));
}
Exemplo n.º 15
0
Arquivo: filedlg.cpp Projeto: KDE/kget
FileDlg::FileDlg(KGetMetalink::File *file, const QStringList &currentFileNames, QSortFilterProxyModel *countrySort, QSortFilterProxyModel *languageSort, QWidget *parent, bool edit)
  : KGetSaveSizeDialog("FileDlg", parent),
    m_file(file),
    m_initialFileName(m_file->name),
    m_currentFileNames(currentFileNames),
    m_edit(edit)
{
    //remove the initial name, to see later if the chosen name is still free
    m_currentFileNames.removeAll(m_initialFileName);

    QWidget *widget = new QWidget(this);
    ui.setupUi(widget);
    setMainWidget(widget);

    m_urlWidget = new UrlWidget(this);
    m_urlWidget->init(&m_file->resources, countrySort);
    ui.urlLayout->addWidget(m_urlWidget->widget());
    connect(m_urlWidget, SIGNAL(urlsChanged()), this, SLOT(slotUpdateOkButton()));

    QWidget *data = new QWidget(this);
    uiData.setupUi(data);
    ui.dataLayout->addWidget(data);

    ui.infoWidget->setCloseButtonVisible(false);
    ui.infoWidget->setMessageType(KMessageWidget::Information);

    //set the file data
    ui.name->setText(m_file->name);
    uiData.identity->setText(m_file->data.identity);
    uiData.version->setText(m_file->data.version);
    uiData.description->setText(m_file->data.description);
    uiData.logo->setUrl(m_file->data.logo);
    if (m_file->data.oses.count()) {
        uiData.os->setText(m_file->data.oses.join(i18nc("comma, to seperate members of a list", ",")));
    }
    uiData.copyright->setText(m_file->data.copyright);
    uiData.pub_name->setText(m_file->data.publisher.name);
    uiData.pub_url->setUrl(m_file->data.publisher.url);

    if (m_file->size) {
        ui.size->setText(QString::number(m_file->size));
    }


    //create the language selection
    uiData.language->setModel(languageSort);
    if (m_file->data.languages.count()) {//TODO 4.5 support multiple languages
        const int index = uiData.language->findData(m_file->data.languages.first());
        uiData.language->setCurrentIndex(index);
    } else {
        //Do not select a language of a file if none was defined.
        uiData.language->setCurrentIndex(-1);
    }


    //create the verification stuff
    m_verificationModel = new VerificationModel(this);
    QHash<QString, QString>::const_iterator it;
    QHash<QString, QString>::const_iterator itEnd = m_file->verification.hashes.constEnd();
    for (it = m_file->verification.hashes.constBegin(); it != itEnd; ++it) {
        m_verificationModel->addChecksum(it.key(), it.value());
    }
    ui.add_hash->setGuiItem(KStandardGuiItem::add());
    ui.remove_hash->setGuiItem(KStandardGuiItem::remove());
    m_verificationProxy = new QSortFilterProxyModel(this);
    m_verificationProxy->setSourceModel(m_verificationModel);
    ui.used_hashes->setSortingEnabled(true);
    ui.used_hashes->hideColumn(VerificationModel::Verified);
    ui.used_hashes->setModel(m_verificationProxy);
    ui.used_hashes->setItemDelegate(new VerificationDelegate(this));
    slotUpdateVerificationButtons();

    connect(m_verificationModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(slotUpdateVerificationButtons()));
    connect(m_verificationModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(slotUpdateVerificationButtons()));
    connect(ui.used_hashes, SIGNAL(clicked(QModelIndex)), this, SLOT(slotUpdateVerificationButtons()));
    connect(ui.add_hash, SIGNAL(clicked()), this, SLOT(slotAddHash()));
    connect(ui.remove_hash, SIGNAL(clicked()), this, SLOT(slotRemoveHash()));
    connect(ui.name, SIGNAL(textEdited(QString)), this, SLOT(slotUpdateOkButton()));
    connect(this, SIGNAL(okClicked()), this, SLOT(slotOkClicked()));

    slotUpdateOkButton();

    setCaption(i18n("File Properties"));
}
Exemplo n.º 16
0
AbstractConfig::AbstractConfig(AbstractContent * content, QWidget * parent)
    : QDialog(parent)
    , m_content(content)
    , m_commonUi(new Ui::AbstractConfig())
    , m_closeButton(0)
    , m_okButton(0)
    , m_frame(FrameFactory::defaultPanelFrame())
{
   

	// WIDGET setup
	QWidget * widget = new QWidget(this);
// 	#if QT_VERSION < 0x040500
// 	widget->setAttribute(Qt::WA_NoSystemBackground, true);
// 	#else
// 	widget->setAttribute(Qt::WA_TranslucentBackground, true);
// 	#endif
	m_commonUi->setupUi(widget);
	
	populateFrameList();
	
	// select the frame
	quint32 frameClass = m_content->frameClass();
	if (frameClass != Frame::NoFrame) {
		for (int i = 0; i < m_commonUi->listWidget->count(); ++i) {
		QListWidgetItem * item = m_commonUi->listWidget->item(i);
		if (item->data(Qt::UserRole).toUInt() == frameClass) {
			item->setSelected(true);
			break;
		}
		}
	}
	
	// read other properties
	m_commonUi->reflection->setChecked(m_content->mirrorEnabled());
	
	connect(m_commonUi->front, SIGNAL(clicked()), m_content, SLOT(slotStackFront()));
	connect(m_commonUi->raise, SIGNAL(clicked()), m_content, SLOT(slotStackRaise()));
	connect(m_commonUi->lower, SIGNAL(clicked()), m_content, SLOT(slotStackLower()));
	connect(m_commonUi->back, SIGNAL(clicked()), m_content, SLOT(slotStackBack()));
	connect(m_commonUi->background, SIGNAL(clicked()), m_content, SIGNAL(backgroundMe()));
	connect(m_commonUi->save, SIGNAL(clicked()), m_content, SLOT(slotSaveAs()));
	connect(m_commonUi->del, SIGNAL(clicked()), m_content, SIGNAL(deleteItem()), Qt::QueuedConnection);
	// autoconnection doesn't work because we don't do ->setupUi(this), so here we connect manually
	connect(m_commonUi->applyLooks, SIGNAL(clicked()), this, SLOT(on_applyLooks_clicked()));
	connect(m_commonUi->newFrame, SIGNAL(clicked()), this, SLOT(on_newFrame_clicked()));
	connect(m_commonUi->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(on_listWidget_itemSelectionChanged()));
	connect(m_commonUi->reflection, SIGNAL(toggled(bool)), this, SLOT(on_reflection_toggled(bool)));

//     // ITEM setup
//     setWidget(widget);
//     static qreal s_propZBase = 99999;
//     setZValue(s_propZBase++);

	QBoxLayout *layout = new QVBoxLayout;
	layout->addWidget(widget);
// 	layout->addWidget(rotateSlider);
// 	layout->addLayout(controlLayout);
	
	m_okButton = new QPushButton(tr("Ok"));
	m_okButton->setDefault(true);
	connect(m_okButton, SIGNAL(clicked()), this, SLOT(slotOkClicked()));
	
	m_closeButton = new QPushButton(tr("Cancel"));
	connect(m_closeButton, SIGNAL(clicked()), this, SLOT(reject()));
	
	setWindowTitle("Item Settings");
	
	QBoxLayout *controlLayout = new QHBoxLayout;
	controlLayout->addStretch(1);
	controlLayout->addWidget(m_closeButton);
	controlLayout->addWidget(m_okButton);
	layout->addLayout(controlLayout);
	
	
	
	setLayout(layout);
/*
#if QT_VERSION >= 0x040600
    // fade in animation
    QPropertyAnimation * ani = new QPropertyAnimation(this, "opacity");
    ani->setEasingCurve(QEasingCurve::OutCubic);
    ani->setDuration(400);
    ani->setStartValue(0.0);
    ani->setEndValue(1.0);
    ani->start(QPropertyAnimation::DeleteWhenStopped);
#endif*/
}
Exemplo n.º 17
0
CameraSelection::CameraSelection(QWidget* const parent)
    : QDialog(parent),
      d(new Private)
{
    qApp->setOverrideCursor(Qt::WaitCursor);

    setWindowTitle(i18n("Camera Configuration"));
    setModal(true);

    const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);

    d->buttons        = new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
    d->buttons->button(QDialogButtonBox::Ok)->setDefault(true);

    d->UMSCameraNameActual  = QLatin1String("Directory Browse");   // Don't be i18n!
    d->UMSCameraNameShown   = i18n("Mounted Camera");
    d->PTPCameraNameShown   = QLatin1String("USB PTP Class Camera");
    d->PTPIPCameraNameShown = QLatin1String("PTP/IP Camera");

    QWidget* const page        = new QWidget(this);
    QGridLayout* mainBoxLayout = new QGridLayout(page);

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

    d->listView = new QTreeWidget(page);
    d->listView->setRootIsDecorated(false);
    d->listView->setSelectionMode(QAbstractItemView::SingleSelection);
    d->listView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    d->listView->setMinimumWidth(350);
    d->listView->setAllColumnsShowFocus(true);
    d->listView->setColumnCount(1);
    d->listView->setHeaderLabels(QStringList() << i18n("Camera List"));
    d->listView->setWhatsThis(i18n("<p>Select the camera name that you want to use here. All "
                                   "default settings on the right panel "
                                   "will be set automatically.</p><p>This list has been generated "
                                   "using the gphoto2 library installed on your computer.</p>"));

    d->searchBar = new SearchTextBar(page, QLatin1String("CameraSelectionSearchBar"));

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

    QGroupBox* const titleBox   = new QGroupBox(i18n("Camera Title"), page);
    QVBoxLayout* const gLayout1 = new QVBoxLayout(titleBox);
    d->titleEdit                = new QLineEdit(titleBox);
    d->titleEdit->setWhatsThis(i18n("<p>Set here the name used in digiKam interface to "
                                    "identify this camera.</p>"));

    gLayout1->addWidget(d->titleEdit);
    gLayout1->setContentsMargins(spacing, spacing, spacing, spacing);
    gLayout1->setSpacing(spacing);

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

    QGroupBox* const portPathBox = new QGroupBox(i18n("Camera Port Type"), page);
    QGridLayout* const gLayout2  = new QGridLayout(portPathBox);
    d->portButtonGroup           = new QButtonGroup(portPathBox);
    d->portButtonGroup->setExclusive(true);

    d->usbButton        = new QRadioButton(i18n("USB"), portPathBox);
    d->usbButton->setWhatsThis(i18n("<p>Select this option if your camera is connected to your "
                                    "computer using a USB cable.</p>"));

    d->serialButton     = new QRadioButton(i18n("Serial"), portPathBox);
    d->serialButton->setWhatsThis(i18n("<p>Select this option if your camera is connected to your "
                                       "computer using a serial cable.</p>"));

    d->networkButton    = new QRadioButton(i18n("Network"), portPathBox);
    d->networkButton->setWhatsThis(i18n("<p>Select this option if your camera is connected to your "
                                        "computer network.</p>"));

    d->portPathComboBox = new QComboBox(portPathBox);
    d->portPathComboBox->setDuplicatesEnabled(false);
    d->portPathComboBox->setWhatsThis(i18n("<p>Select the serial port to use on your computer here. "
                                           "This option is only required if you use a serial camera.</p>"));

    d->networkEdit      = new QLineEdit(portPathBox);
    d->networkEdit->setWhatsThis(i18n("<p>Enter here the network address of your camera.</p>"));
    d->networkEdit->setInputMask(QLatin1String("000.000.000.000"));
    d->networkEdit->setText(QLatin1String("192.168.001.001"));

    d->portButtonGroup->addButton(d->usbButton);
    d->portButtonGroup->addButton(d->serialButton);
    d->portButtonGroup->addButton(d->networkButton);

    gLayout2->addWidget(d->usbButton,        0, 0, 1, 2);
    gLayout2->addWidget(d->serialButton,     1, 0, 1, 2);
    gLayout2->addWidget(d->portPathComboBox, 1, 1, 1, 2);
    gLayout2->addWidget(d->networkButton,    2, 0, 1, 2);
    gLayout2->addWidget(d->networkEdit,      2, 1, 1, 2);
    gLayout2->setContentsMargins(spacing, spacing, spacing, spacing);
    gLayout2->setSpacing(spacing);

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

    QGroupBox* const umsMountBox = new QGroupBox(i18n("Camera Mount Path"), page);
    QVBoxLayout* const gLayout3  = new QVBoxLayout(umsMountBox);

    QLabel* const umsMountLabel = new QLabel(umsMountBox);
    umsMountLabel->setText(i18n("Note: only for USB/IEEE mass storage cameras."));

    d->umsMountURL = new DFileSelector(umsMountBox);
    d->umsMountURL->setFileDlgPath(QLatin1String("/mnt/camera"));
    d->umsMountURL->setFileDlgMode(QFileDialog::Directory);
    d->umsMountURL->setWhatsThis(i18n("<p>Set here the mount path to use on your computer. This "
                                      "option is only required if you use a <b>USB Mass Storage</b> "
                                      "camera.</p>"));

    gLayout3->addWidget(umsMountLabel);
    gLayout3->addWidget(d->umsMountURL);
    gLayout3->setContentsMargins(spacing, spacing, spacing, spacing);
    gLayout3->setSpacing(spacing);

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

    QWidget* const box2         = new QWidget(page);
    QGridLayout* const gLayout4 = new QGridLayout(box2);

    QLabel* const logo = new QLabel(box2);
    logo->setPixmap(QIcon::fromTheme(QLatin1String("digikam")).pixmap(QSize(48,48)));

    QLabel* const link = new QLabel(box2);
    link->setText(i18n("<p>To set a <b>USB Mass Storage</b> camera<br/>"
                       "(which looks like a removable drive when mounted<br/>"
                       "on your desktop), please use<br/>"
                       "<a href=\"umscamera\">%1</a> from the camera list.</p>",
                       d->UMSCameraNameShown));

    QLabel* const link2 = new QLabel(box2);
    link2->setText(i18n("<p>To set a <b>Generic PTP USB Device</b><br/>"
                        "(which uses Picture Transfer Protocol), please<br/>"
                        "use <a href=\"ptpcamera\">%1</a> from the camera list.</p>",
                        d->PTPCameraNameShown));

    QLabel* const link3 = new QLabel(box2);
    link3->setText(i18n("<p>To set a <b>Generic PTP/IP Network Device</b><br/>"
                        "(which uses Picture Transfer Protocol), please<br/>"
                        "use <a href=\"ptpipcamera\">%1</a> from the camera list.</p>",
                        d->PTPIPCameraNameShown));

    QLabel* const explanation = new QLabel(box2);
    explanation->setOpenExternalLinks(true);
    explanation->setText(i18n("<p>A complete list of camera settings to use is<br/>"
                              "available at <a href='http://www.teaser.fr/~hfiguiere/linux/digicam.html'>"
                              "this URL</a>.</p>"));

    gLayout4->setContentsMargins(spacing, spacing, spacing, spacing);
    gLayout4->setSpacing(spacing);
    gLayout4->addWidget(logo,        0, 0, 1, 1);
    gLayout4->addWidget(link,        0, 1, 2, 1);
    gLayout4->addWidget(link2,       2, 1, 2, 1);
    gLayout4->addWidget(link3,       4, 1, 2, 1);
    gLayout4->addWidget(explanation, 6, 1, 2, 1);

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

    mainBoxLayout->addWidget(d->listView,  0, 0, 6, 1);
    mainBoxLayout->addWidget(d->searchBar, 7, 0, 1, 1);
    mainBoxLayout->addWidget(titleBox,     0, 1, 1, 1);
    mainBoxLayout->addWidget(portPathBox,  1, 1, 1, 1);
    mainBoxLayout->addWidget(umsMountBox,  2, 1, 1, 1);
    mainBoxLayout->addWidget(box2,         3, 1, 2, 1);
    mainBoxLayout->setColumnStretch(0, 10);
    mainBoxLayout->setRowStretch(6, 10);
    mainBoxLayout->setContentsMargins(QMargins());
    mainBoxLayout->setSpacing(spacing);

    QVBoxLayout* const vbx = new QVBoxLayout(this);
    vbx->addWidget(page);
    vbx->addWidget(d->buttons);
    setLayout(vbx);

    // Connections --------------------------------------------------

    connect(link, SIGNAL(linkActivated(QString)),
            this, SLOT(slotUMSCameraLinkUsed()));

    connect(link2, SIGNAL(linkActivated(QString)),
            this, SLOT(slotPTPCameraLinkUsed()));

    connect(link3, SIGNAL(linkActivated(QString)),
            this, SLOT(slotPTPIPCameraLinkUsed()));

    connect(d->networkEdit, SIGNAL(textChanged(QString)),
            this, SLOT(slotNetworkEditChanged(QString)));

    connect(d->listView, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
            this, SLOT(slotSelectionChanged(QTreeWidgetItem*,int)));

    connect(d->portButtonGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(slotPortChanged()));

    connect(d->searchBar, SIGNAL(signalSearchTextSettings(SearchTextSettings)),
            this, SLOT(slotSearchTextChanged(SearchTextSettings)));

    connect(d->buttons->button(QDialogButtonBox::Ok), SIGNAL(clicked()),
            this, SLOT(slotOkClicked()));

    connect(d->buttons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()),
            this, SLOT(reject()));

    connect(d->buttons->button(QDialogButtonBox::Help), SIGNAL(clicked()),
            this, SLOT(slotHelp()));

    // Initialize  --------------------------------------------------

#ifndef HAVE_GPHOTO2
    // If digiKam is compiled without Gphoto2 support, we hide widgets relevant.
    d->listView->hide();
    d->searchBar->hide();
    box2->hide();
    slotUMSCameraLinkUsed();
#else
    getCameraList();
    getSerialPortList();
#endif /* HAVE_GPHOTO2 */

    qApp->restoreOverrideCursor();
}