Ejemplo n.º 1
0
void QFCropPixelsEdit::spinValueChanged()
{
    connectWidgets(false);
    if (spinX2->value()<=spinX1->value()) {
        spinX1->setValue(spinX2->value()+1);
    }
    if (spinY2->value()<=spinY1->value()) {
        spinY1->setValue(spinY2->value()+1);
    }
    connectWidgets(true);
    emit valueChanged(getX1(), getX2(), getY1(), getY2());
}
Ejemplo n.º 2
0
bool DC1394Slider::init(dc1394feature_id_t feature, char* label, DC1394Thread *controlThread)
{
    m_Feature=feature;
    this->controlThread = controlThread;

    connect(controlThread,SIGNAL(sliderRefreshDone(QObject*,bool,bool,bool,bool,bool,bool,double)),
            this,SLOT(onRefreshDone(QObject*,bool,bool,bool,bool,bool,bool,double)),Qt::QueuedConnection);

    connect(controlThread,SIGNAL(sliderSetFeatureDC1394Done(QObject*,double)),
            this,SLOT(onSliderSetFeatureDone(QObject*,double)),Qt::QueuedConnection);

    connect(controlThread,SIGNAL(sliderPowerDone(QObject*,bool,bool,bool,bool)),
            this,SLOT(onPowerDone(QObject*,bool,bool,bool,bool)),Qt::QueuedConnection);

    connect(controlThread,SIGNAL(sliderHasFeatureDone(QObject*,bool)),
           this,SLOT(onHasFeatureDone(QObject*,bool)),Qt::QueuedConnection);


    type = SLIDER;
    m_Name=label;

    ui->label->setTitle(m_Name);

    connectWidgets();

    QVariantList list;
    list.append(qVariantFromValue((void*)this));
    list.append(QVariant((int)m_Feature));
    controlThread->doTask(_sliderHasFeature,list);

    return true;
}
Ejemplo n.º 3
0
AddAllExtraPoints::AddAllExtraPoints(Gradebook *book, QWidget *parent)
    :QDialog(parent),
     gradebook(book),
     titleLabel(new QLabel("<font size=3><b>Add Extra Credit</b></font>", this)),
     boxLabel(new QLabel("Points:", this)),
     pointsBox(new QLineEdit(this)),
     submitButton(new QPushButton("Submit", this)),
     cancelButton(new QPushButton("Cancel", this)),
     messageWin(new QMessageBox(this))
{
    setWindowTitle("Add Extra Credit");
    titleLabel->setAlignment(Qt::AlignHCenter);
    titleLabel->setFrameStyle(QFrame::Box);
    titleLabel->setLineWidth(1);
    boxLabel->setAlignment(Qt::AlignHCenter);

    QVBoxLayout *vertLayout = new QVBoxLayout;
    QHBoxLayout *botLayout = new QHBoxLayout;
    QHBoxLayout *midLayout = new QHBoxLayout;

    midLayout->addWidget(boxLabel);
    midLayout->addWidget(pointsBox);

    botLayout->addWidget(cancelButton);
    botLayout->addWidget(submitButton);

    vertLayout->addWidget(titleLabel);
    vertLayout->addLayout(midLayout);
    vertLayout->addLayout(botLayout);

    pointsBox->setValidator(new QIntValidator(this));
    setLayout(vertLayout);
    connectWidgets();
    resize(sizeHint());
}
Ejemplo n.º 4
0
/********************** AddIndvAssignmentDialog Functions**********************/
AddIndvAssignmentDialog::AddIndvAssignmentDialog(Student *stu, QWidget *parent)
	:AssignmentDialogBase(parent),
	student(stu),
	earnedPointsBox(new QLineEdit(this)),
	earnedPointsLabel(new QLabel("Points earned:", this))
{
	earnedPointsLabel->setAlignment(Qt::AlignHCenter);
	setWindowTitle("Add Individual Assignment");
	titleLabel->setText("<font size=4><b>Add Assignment</b></font>");
	titleLabel->setFrameStyle(QFrame::Box);
	titleLabel->setLineWidth(1);
	boxOneLabel->setText("Assignment name:");
	boxTwoLabel->setText("Points possible:");

	QHBoxLayout *newHorLayout = new QHBoxLayout;
	newHorLayout->addStretch(1);
	newHorLayout->addWidget(earnedPointsLabel);
	newHorLayout->addWidget(earnedPointsBox);
	vertLayout->insertLayout(3, newHorLayout);

	// Set the tab order for the Widget
	setTabOrder(boxOne, boxTwo);
	setTabOrder(boxTwo, earnedPointsBox);
	setTabOrder(earnedPointsBox, submitButton);
	setTabOrder(submitButton, cancelButton);

	// Set validators and connect widgets
	submitButton->setEnabled(false);
	boxTwo->setValidator(new QDoubleValidator(this));
	boxTwo->setMaxLength(5);
	earnedPointsBox->setValidator(new QDoubleValidator(this));
	earnedPointsBox->setMaxLength(5);
	connectWidgets();
}
Ejemplo n.º 5
0
QFCropPixelsEdit::QFCropPixelsEdit(QWidget *parent) : QWidget(parent)
{
    lay=new QHBoxLayout();
    lay->setContentsMargins(0,0,0,0);
    spinX1=new QSpinBox(this);
    spinX2=new QSpinBox(this);
    spinY1=new QSpinBox(this);
    spinY2=new QSpinBox(this);

    lay->addWidget(new QLabel("x = ", this));
    lay->addWidget(spinX1);
    lay->addWidget(new QLabel(" ... ", this));
    lay->addWidget(spinX2);
    lay->addWidget(new QLabel("   y = ", this));
    lay->addWidget(spinY1);
    lay->addWidget(new QLabel(" ... ", this));
    lay->addWidget(spinY2);


    setImageSize(0,1);
    setFullImageSize();
    connectWidgets(true);
    setLayout(lay);

}
Ejemplo n.º 6
0
// DkControlWidget --------------------------------------------------------------------
DkControlWidget::DkControlWidget(DkViewPort *parent, Qt::WindowFlags flags) : QWidget(parent, flags) {

	mViewport = parent;
	setObjectName("DkControlWidget");
	qDebug() << metaObject()->className();

	// cropping
	mCropWidget = new DkCropWidget(QRectF(), this);

	//// thumbnails, metadata
	//thumbPool = new DkThumbPool(QFileInfo(), this);
	mFilePreview = new DkFilePreview(this, flags);
	mMetaDataInfo = new DkMetaDataHUD(this);
	mZoomWidget = new DkZoomWidget(this);
	mPlayer = new DkPlayer(this);
	addActions(mPlayer->getActions().toList());

	mFolderScroll = new DkFolderScrollBar(this);

	// file info - overview
	mFileInfoLabel = new DkFileInfoLabel(this);
	mRatingLabel = new DkRatingLabelBg(2, this, flags);
	addActions(mRatingLabel->getActions().toList());		// register actions
	mCommentWidget = new DkCommentWidget(this);

	// delayed info
	mDelayedInfo = new DkDelayedMessage(QString(), 0, this); // TODO: make a nice constructor
	mDelayedSpinner = new DkDelayedInfo(0, this);

	// info labels
	int loadSize = qMax(Settings::param().display().iconSize, 64);
	mSpinnerLabel = new DkAnimationLabel(":/nomacs/img/loading.svg", QSize(loadSize, loadSize), this);
	mCenterLabel = new DkLabelBg(this, "");
	mBottomLabel = new DkLabelBg(this, "");
	mBottomLeftLabel = new DkLabelBg(this, "");

	// wheel label
	QPixmap wp = QPixmap(":/nomacs/img/thumbs-move.svg");

	mWheelButton = new QLabel(this);
	mWheelButton->setAttribute(Qt::WA_TransparentForMouseEvents);
	mWheelButton->setPixmap(wp);
	mWheelButton->adjustSize();
	mWheelButton->hide();

	// image histogram
	mHistogram = new DkHistogram(this);
	
	init();
	connectWidgets();

	// add mousetracking to all widgets which allows the mViewport for status updates
	QObjectList widgets = children();
	for (int idx = 0; idx < widgets.size(); idx++) {
		if (QWidget* w = qobject_cast<QWidget*>(widgets.at(idx))) {
			w->setMouseTracking(true);
		}
	}
}
Ejemplo n.º 7
0
ImageViewer::ImageViewer()
{
	createWidgets();
	createActions();
	createMenus();
	createStatusBar();
	connectWidgets();
}
Ejemplo n.º 8
0
void
PartitionSizeController::setSpinBox( QSpinBox* spinBox )
{
    if ( m_spinBox )
        disconnect( m_spinBox, 0, this, 0 );
    m_spinBox = spinBox;
    m_spinBox->setMaximum( std::numeric_limits< int >::max() );
    connectWidgets();
}
Ejemplo n.º 9
0
void QFCropPixelsEdit::setCropRange(int x1, int x2, int y1, int y2)
{
    connectWidgets(false);
    if (x1<=x2) {
        spinX1->setValue(x1);
        spinX2->setValue(x2);
    } else {
        spinX1->setValue(x2);
        spinX2->setValue(x1);
    }
    if (y1<=y2) {
        spinY1->setValue(y1);
        spinY2->setValue(y2);
    } else {
        spinY1->setValue(y2);
        spinY2->setValue(y1);
    }
    connectWidgets(true);
}
Ejemplo n.º 10
0
HelpWidget::HelpWidget(ArpmanetDC *parent)
{
    //Constructor
    pParent = parent;

    connect(this, SIGNAL(ftpCheckForUpdate()), pParent, SIGNAL(ftpCheckForUpdate()));

    createWidgets();
    placeWidgets();
    connectWidgets();
}
Ejemplo n.º 11
0
/********************* AddExtraPointsDialog **********************************/
AddExtraPointsDialog::AddExtraPointsDialog(Student *stu, QWidget *parent)
	:AssignmentDialogBase(parent),
	student(stu)
{
	boxOneLabel->setText("Extra points:");
	boxTwoLabel->hide();
	boxTwo->hide();

	submitButton->setEnabled(false);
	boxOne->setValidator(new QDoubleValidator(this));
	connectWidgets();
}
Ejemplo n.º 12
0
Configuration::Configuration(Applet *applet, KConfigDialog *parent) : QObject(parent),
    m_applet(applet)
{
    KConfigGroup configuration = m_applet->config();
    QWidget *generalWidget = new QWidget;
    QWidget *controlsWidget = new QWidget;
    QStringList controls;
    controls << "open" << "playPause" << "stop" << "position" << "volume" << "playlist";
    controls = configuration.readEntry("controls", controls);

    m_generalUi.setupUi(generalWidget);
    m_controlsUi.setupUi(controlsWidget);

    connectWidgets(generalWidget);
    connectWidgets(controlsWidget);

    m_generalUi.startPlaybackCheckBox->setChecked(configuration.readEntry("playOnStartup", false));
    m_generalUi.dbusCheckBox->setChecked(configuration.readEntry("enableDBus", false));
    m_generalUi.inhibitNotificationsCheckBox->setChecked(configuration.readEntry("inhibitNotifications", false));
    m_generalUi.showTooltipOnTrackChange->setValue(configuration.readEntry("showToolTipOnTrackChange", 3));

    m_controlsUi.openCheckBox->setChecked(controls.contains("open"));
    m_controlsUi.playPauseCheckBox->setChecked(controls.contains("playPause"));
    m_controlsUi.stopCheckBox->setChecked(controls.contains("stop"));
    m_controlsUi.playPreviousCheckBox->setChecked(controls.contains("playPrevious"));
    m_controlsUi.playNextCheckBox->setChecked(controls.contains("playNext"));
    m_controlsUi.positionCheckBox->setChecked(controls.contains("position"));
    m_controlsUi.volumeCheckBox->setChecked(controls.contains("volume"));
    m_controlsUi.muteCheckBox->setChecked(controls.contains("mute"));
    m_controlsUi.playlistCheckBox->setChecked(controls.contains("playlist"));
    m_controlsUi.fullScreenCheckBox->setChecked(controls.contains("fullScreen"));

    parent->addPage(generalWidget, i18n("General"), "go-home");
    parent->addPage(controlsWidget, i18n("Visible Controls"), "media-playback-start");

    connect(parent, SIGNAL(applyClicked()), this, SLOT(save()));
    connect(parent, SIGNAL(okClicked()), this, SLOT(save()));
    connect(m_generalUi.showTooltipOnTrackChange, SIGNAL(valueChanged(int)), this, SLOT(modify()));
}
/************************* EditMultipleAssignments ***************************/
EditMultipleAssignments::EditMultipleAssignments(const std::string &assignName,
												 Gradebook *book, QWidget *parent)
	:QDialog(parent),
	gradebook(book),
	assignmentName(assignName),
	titleLabel(new QLabel("<font size=3><b>Edit Multiple Assignments</b></font>", this)),
	assignNameLabel(new QLabel("", this)),
	pointValueLabel(new QLabel("", this)),
	boxLabel(new QLabel("New Point Value:", this)),
	pointsBox(new QLineEdit(this)),
	saveButton(new QPushButton("Save", this)),
	cancelButton(new QPushButton("Cancel", this)),
	messageWin(new QMessageBox(this))
{
	setWindowTitle("Edit Assignment");
	titleLabel->setAlignment(Qt::AlignHCenter);
	titleLabel->setFrameStyle(QFrame::Box);
	titleLabel->setLineWidth(1);

	assignNameLabel->setAlignment(Qt::AlignHCenter);
	pointValueLabel->setAlignment(Qt::AlignHCenter);

	QVBoxLayout *vertLayout = new QVBoxLayout;
	QHBoxLayout *botLayout = new QHBoxLayout;
	QHBoxLayout *midLayout = new QHBoxLayout;

	botLayout->addWidget(cancelButton);
	botLayout->addWidget(saveButton);

	midLayout->addWidget(boxLabel);
	midLayout->addWidget(pointsBox);

	vertLayout->addWidget(titleLabel);
	vertLayout->addWidget(assignNameLabel);
	vertLayout->addWidget(pointValueLabel);
	vertLayout->addLayout(midLayout);
	vertLayout->addLayout(botLayout);

	setLayout(vertLayout);

	saveButton->setEnabled(false);
	pointsBox->setValidator(new QDoubleValidator(this));
	if(gradebook)
	{
		loadAssignmentData();
	}
	connectWidgets();
	resize(sizeHint());
}
Ejemplo n.º 14
0
DataCutSliders::DataCutSliders(QWidget* parent):
    QWidget(parent)
{
    //setMaximumHeight(60);
    //setMinimumHeight(60);

    runsName=tr("runs");
    filesName=tr("files");
    copyToRunsEnabled=true;
    copyToFilesEnabled=true;

    sliderSignals=true;
    allowCopyToAll=true;
    min=0;
    max=1000;
    userMin=0;
    userMax=1000;


    QHBoxLayout* layout=new QHBoxLayout();
    layout->setContentsMargins(0,0,0,0);
    setLayout(layout);

    editLow=new QSpinBox(this);
    editHigh=new QSpinBox(this);
    editLow->setRange(min, max);
    editHigh->setRange(min, max);
    editLow->setContextMenuPolicy(Qt::NoContextMenu);
    editHigh->setContextMenuPolicy(Qt::NoContextMenu);



    QLabel* lab1=new QLabel(tr("<b>lower & upper cut-off</b>"), this);
    lab1->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
    labCentral=lab1;
    /*layout->addWidget(editLow,  0, 0, Qt::AlignLeft|Qt::AlignTop);
    layout->addWidget(lab1, 0, 1, Qt::AlignRight|Qt::AlignBottom);
    layout->addWidget(editHigh, 0, 2, Qt::AlignRight|Qt::AlignTop);
    layout->setColumnStretch(0,1);
    layout->setColumnStretch(2,1);*/
    layout->addWidget(editLow,  0, Qt::AlignLeft|Qt::AlignTop);
    layout->addWidget(lab1,  1, Qt::AlignRight|Qt::AlignBottom);
    layout->addWidget(editHigh,  0, Qt::AlignRight|Qt::AlignTop);
    contextMenu=NULL;

    connectWidgets(true);
    updateSliderWidgets();
}
Ejemplo n.º 15
0
/*!
 * \brief Legge l'immagine
 */
void SurfaceWidget::loadSurface()
{
  ReadImageDialog dialog(this, "Load " + m_Name);
  if ( dialog.exec() )
  {
    // Se c'è una superficie già aperta la chiude
    if (m_Loaded)
      closeSurface();


    std::cout << "filename: " << dialog.getFilename().c_str() << std::endl;
    // Legge l'immagine
    vtkGenericMedicalImageReader* reader = vtkGenericMedicalImageReader::New();
    if (dialog.useDirectory())
      reader->SetDirectoryName(dialog.getDirectory().c_str());
    else
      reader->SetFileName (dialog.getFilename().c_str());
    reader->SetImageType(dialog.getImageType());
    reader->Update();

    // Crea l'actor
    m_Surface3DActor = Surface3DActor::New();
    m_Surface3DActor->SetInput ( reader->GetOutput() );

    // Setta il range
    double range[2];
    reader->GetOutput()->GetScalarRange(range);
    setValueWidgets(range[0]+1, range[1], range[0]+1, 1);


    // Connette i widgets, eccetera
    setDisabled(false);
    connectWidgets();

    m_Loaded = true;
    reader->Delete();

    applySurfaceValue();

    for(RendererListType::iterator iter = m_RendererList.begin(); iter != m_RendererList.end(); iter++)
    {
      (*iter)->AddActor(m_Surface3DActor);
      (*iter)->ResetCamera();
    }

    render();
  }
}
Ejemplo n.º 16
0
AddAssignmentDialog::AddAssignmentDialog(Gradebook *book, QWidget *parent)
	:AssignmentDialogBase(parent),
	gradebook(book)
{
	setWindowTitle("Add Assignment All");
	titleLabel->setFrameStyle(QFrame::Box);
	titleLabel->setLineWidth(1);
	titleLabel->setText("<font size=4><b>Add Assignment All</b></font>");
	boxOneLabel->setText("Assignment name:");
	boxTwoLabel->setText("Point value:");

	submitButton->setEnabled(false);
	boxTwo->setValidator(new QDoubleValidator(this));
	boxTwo->setMaxLength(5);
	connectWidgets();
}
Ejemplo n.º 17
0
/*********************** EditIndvAssignmentDialog *****************************/
EditIndvAssignmentDialog::EditIndvAssignmentDialog(Student *stu, const std::string &name,
												   QWidget *parent)
	:AssignmentDialogBase(parent),
	student(stu),
	assignmentName(name),
	confirmWin(new QMessageBox(this)),
	earnedPointsBox(new QLineEdit(this)),
	earnedPointsLabel(new QLabel("Points earned:", this)),
	origName(new QLabel("", this)),
	origPoints(new QLabel("", this))
{
	titleLabel->setText("<font size=4><b>Edit Assignment</b></font>");
	titleLabel->setFrameStyle(QFrame::Box);
	titleLabel->setLineWidth(1);
	boxOneLabel->setText("Assignment name:");
	boxTwoLabel->setText("Points possible:");

	origName->setText("<b>Current name:</b> ");
	origPoints->setText("<b>Current points:<b> ");
	origName->setAlignment(Qt::AlignHCenter);
	origPoints->setAlignment(Qt::AlignHCenter);

	QHBoxLayout *newHorLayout = new QHBoxLayout;
	newHorLayout->addStretch(1);
	newHorLayout->addWidget(earnedPointsLabel);
	newHorLayout->addWidget(earnedPointsBox);
	vertLayout->insertLayout(3, newHorLayout);

	vertLayout->insertWidget(1, origName);
	vertLayout->insertWidget(2, origPoints);
	vertLayout->insertSpacing(1, 15);
	vertLayout->insertSpacing(4, 15);

	// Set the tab order for the Widget
	setTabOrder(boxOne, boxTwo);
	setTabOrder(boxTwo, earnedPointsBox);
	setTabOrder(earnedPointsBox, submitButton);
	setTabOrder(submitButton, cancelButton);

	submitButton->setEnabled(false);
	boxTwo->setValidator(new QDoubleValidator(this));
	boxTwo->setMaxLength(5);
	earnedPointsBox->setValidator(new QDoubleValidator(this));
	earnedPointsBox->setMaxLength(5);
	connectWidgets();
	resize(sizeHint());
}
Ejemplo n.º 18
0
void MVAmpEnvelope_UI::updateUI()
{
    disconnectWidgets();
    for(int i=0;i<NB_ENV_PTS;i++)
    {
        dialsTime[i]->setValue(indexOfTime(framesTomsec(envData.points[i].frame)));
        dialsValue[i]->setMainColor(i == envData.sustainPoint ? QColor::fromRgb(92,0,0) : Qt::black);
        dialsTime[i]->setMainColor(i == envData.sustainPoint ? QColor::fromRgb(92,0,0) : Qt::black);
    }
    cbLoop->setChecked(envData.loop);

    for(int i=0;i<NB_ENV_PTS-1;i++)
        dialsValue[i]->setValue(envData.points[i].value*100 );

    updateLabels();
    envDrawer->update();
    connectWidgets();
}
Ejemplo n.º 19
0
bool DC1394SliderWB::init(DC1394Thread *controlThread)
{
//    if (!((pFG=fg)->hasFeatureDC1394(YARP_FEATURE_WHITE_BALANCE))){

//        m_bInactive=true;
//        setVisible(false);
//        return false;
//    }
    this->controlThread = controlThread;

    connect(controlThread,SIGNAL(sliderHasFeatureDone(QObject*,bool)),
           this,SLOT(onHasFeatureDone(QObject*,bool)),Qt::QueuedConnection);

    connect(controlThread,SIGNAL(sliderWBRefreshDone(QObject*,bool,bool,bool,bool,bool,bool,double,double)),
            this,SLOT(onRefreshDone(QObject*,bool,bool,bool,bool,bool,bool,double,double)),Qt::QueuedConnection);

    connect(controlThread,SIGNAL(sliderWBSetFeatureDC1394Done(QObject*,double,double)),
            this,SLOT(onSliderWBSetFeatureDone(QObject*,double,double)),Qt::QueuedConnection);

    connect(controlThread,SIGNAL(sliderRadioAutoDone(QObject*,bool,bool)),
            this,SLOT(onRadioAutoDone(QObject*,bool,bool)),Qt::QueuedConnection);

    connect(controlThread,SIGNAL(sliderPowerDone(QObject*,bool,bool,bool,bool)),
            this,SLOT(onPowerDone(QObject*,bool,bool,bool,bool)),Qt::QueuedConnection);

    connect(controlThread,SIGNAL(sliderWBOnePushDone(QObject*,double,double)),
            this,SLOT(onOnePushDone(QObject*,double,double)),Qt::QueuedConnection);

    type = SLIDERWB;

    ui->label->setTitle("White Balance");

    connectWidgets();

    QVariantList list;
    list.append(qVariantFromValue((void*)this));
    list.append(QVariant((int)YARP_FEATURE_WHITE_BALANCE));
    controlThread->doTask(_sliderHasFeature,list);

    return true;

}
Ejemplo n.º 20
0
void
PartitionSizeController::setPartResizerWidget( PartResizerWidget* widget, bool format )
{
    Q_ASSERT( m_device );

    if ( m_partResizerWidget )
        disconnect( m_partResizerWidget, 0, this, 0 );

    // Update partition filesystem. This must be done *before* the call to
    // PartResizerWidget::init() otherwise it will be ignored by the widget.
    // This is why this method accept a `format` boolean.
    qint64 used = format ? 0 : m_originalPartition->fileSystem().sectorsUsed();
    m_partition->fileSystem().setSectorsUsed( used );

    // Init PartResizerWidget
    m_partResizerWidget = widget;
    PartitionTable* table = m_device->partitionTable();
    qint64 minFirstSector = m_originalPartition->firstSector() - table->freeSectorsBefore( *m_originalPartition );
    qint64 maxLastSector = m_originalPartition->lastSector() + table->freeSectorsAfter( *m_originalPartition );
    m_partResizerWidget->init( *m_device, *m_partition.data(), minFirstSector, maxLastSector );

    // FIXME: Should be set by PartResizerWidget itself
    m_partResizerWidget->setFixedHeight( PartResizerWidget::handleHeight() );

    QPalette pal = widget->palette();
    pal.setColor( QPalette::Base, ColorUtils::freeSpaceColor() );
    pal.setColor( QPalette::Button, m_partitionColor );
    m_partResizerWidget->setPalette( pal );
    connectWidgets();

    if ( !format )
    {
        // If we are not formatting, update the widget to make sure the space
        // between the first and last sectors is big enough to fit the existing
        // content.
        updatePartResizerWidget();
    }
}
Ejemplo n.º 21
0
DescrGeneratorInterface::DescrGeneratorInterface (QWidget* parent, MainWindow* window) :
    QWidget(parent),
    parentWindow(window),
    labelMainTemplate(new QLabel("Main Template", this)),
    editMainTemplate(new QLineEdit(this)),
    buttonMainTemplate(new QPushButton("Apri", this)),
    labelResourcesTemplate(new QLabel("Res. Template", this)),
    editResourcesTemplate(new QLineEdit(this)),
    buttonResourcesTemplate(new QPushButton("Apri", this)),
    labelVideoResourcesTemplate(new QLabel("Video Res. Template", this)),
    editVideoResourcesTemplate(new QLineEdit(this)),
    buttonVideoResourcesTemplate(new QPushButton("Apri", this)),
    labelVideoTemplate(new QLabel("Video Template", this)),
    editVideoTemplate(new QLineEdit(this)),
    buttonVideoTemplate(new QPushButton("Apri", this)),
    labelCatMerc(new QLabel("Cat. Merc.", this)),
    editCatMerc(new QLineEdit(this)),
    labelNatura(new QLabel("Natura", this)),
    editNatura(new QLineEdit(this)),
    labelFile(new QLabel("File destinazione", this)),
    editFile(new QLineEdit(this)),
    buttonFile(new QPushButton("Scegli", this)),
    buttonCrea(new QPushButton("Crea", this)),
    layoutButton(new QHBoxLayout),
    gridLayout(new QGridLayout(this)),
    progress(new QProgressBar(this)),
    worker_thread(0),
    generator(0)
{
    setLayout(gridLayout);

    resizeWidgets();
    layoutWidgets();
    connectWidgets();
    loadConfig();
}
EditAllAssignmentsDialog::EditAllAssignmentsDialog(Gradebook *book, QWidget *parent)
	:QDialog(parent),
	gradebook(book),
	titleLabel(new QLabel("<font size=4><b>Edit Common Assignments</b></font>", this)),
	commonLabel(new QLabel("Common Assignments", this)),
	assignmentList(new QListWidget(this)),
	editButton(new QPushButton("Edit Assignment", this)),
	closeButton(new QPushButton("Cancel", this)),
	editWindow(new EditMultipleAssignments("", NULL, this)),
	messageWin(new QMessageBox(this))
{
	setWindowTitle("Edit Common Assignments");
	titleLabel->setAlignment(Qt::AlignHCenter);
	titleLabel->setFrameStyle(QFrame::Box);
	titleLabel->setLineWidth(1);
	commonLabel->setAlignment(Qt::AlignHCenter);

	QVBoxLayout *vertLayout = new QVBoxLayout;
	QHBoxLayout *botLayout = new QHBoxLayout;

	botLayout->addWidget(closeButton);
	botLayout->addWidget(editButton);

	vertLayout->addWidget(titleLabel);
	vertLayout->addWidget(commonLabel);
	vertLayout->addWidget(assignmentList);
	vertLayout->addLayout(botLayout);

	connectWidgets();
	if(gradebook)
	{
		populateAssignments();
	}
	setLayout(vertLayout);
	resize(sizeHint());
}
Ejemplo n.º 23
0
Configuration::Configuration(Applet *applet, KConfigDialog *parent) : QObject(parent),
    m_applet(applet),
    m_editedLauncher(NULL)
{
    KConfigGroup configuration = m_applet->config();
    KMenu *addLauncherMenu = new KMenu(parent);
    QWidget *generalWidget = new QWidget;
    QWidget *appearanceWidget = new QWidget;
    QWidget *arrangementWidget = new QWidget;
    QWidget *actionsWidget = new QWidget;
    QAction *addLauncherApplicationAction = addLauncherMenu->addAction(KIcon("application-x-executable"), i18n("Add Application..."));
    QAction *addLauncherFromFileAction = addLauncherMenu->addAction(KIcon("inode-directory"), i18n("Add File or Directory..."));
    QAction *addMenuLauncher = addLauncherMenu->addAction(KIcon("start-here"), i18n("Add Menu"));
    KMenu *addMenuLauncherMenu = new KMenu(addLauncherMenu);

    addMenuLauncher->setMenu(addMenuLauncherMenu);

    QAction *action = addMenuLauncherMenu->addAction(QString());
    action->setData("/");
    action->setVisible(false);

    m_generalUi.setupUi(generalWidget);
    m_appearanceUi.setupUi(appearanceWidget);
    m_arrangementUi.setupUi(arrangementWidget);
    m_actionsUi.setupUi(actionsWidget);

    connectWidgets(generalWidget);
    connectWidgets(appearanceWidget);

    m_arrangementUi.addLauncherButton->setMenu(addLauncherMenu);

    m_generalUi.groupingStrategy->addItem(i18n("Do Not Group"), QVariant(TaskManager::GroupManager::NoGrouping));
    m_generalUi.groupingStrategy->addItem(i18n("Manually"), QVariant(TaskManager::GroupManager::ManualGrouping));
    m_generalUi.groupingStrategy->addItem(i18n("By Program Name"), QVariant(TaskManager::GroupManager::ProgramGrouping));
    m_generalUi.groupingStrategy->setCurrentIndex(m_generalUi.groupingStrategy->findData(QVariant(configuration.readEntry("groupingStrategy", static_cast<int>(TaskManager::GroupManager::NoGrouping)))));

    m_generalUi.sortingStrategy->addItem(i18n("Do Not Sort"), QVariant(TaskManager::GroupManager::NoSorting));
    m_generalUi.sortingStrategy->addItem(i18n("Manually"), QVariant(TaskManager::GroupManager::ManualSorting));
    m_generalUi.sortingStrategy->addItem(i18n("Alphabetically"), QVariant(TaskManager::GroupManager::AlphaSorting));
    m_generalUi.sortingStrategy->addItem(i18n("By Desktop"), QVariant(TaskManager::GroupManager::DesktopSorting));
    m_generalUi.sortingStrategy->setCurrentIndex(m_generalUi.sortingStrategy->findData(QVariant(configuration.readEntry("sortingStrategy", static_cast<int>(TaskManager::GroupManager::ManualSorting)))));

    m_generalUi.showOnlyCurrentDesktop->setChecked(configuration.readEntry("showOnlyCurrentDesktop", false));
    m_generalUi.showOnlyCurrentActivity->setChecked(configuration.readEntry("showOnlyCurrentActivity", true));
    m_generalUi.showOnlyCurrentScreen->setChecked(configuration.readEntry("showOnlyCurrentScreen", false));
    m_generalUi.showOnlyMinimized->setChecked(configuration.readEntry("showOnlyMinimized", false));
    m_generalUi.showOnlyTasksWithLaunchers->setChecked(configuration.readEntry("showOnlyTasksWithLaunchers", false));
    m_generalUi.connectJobsWithTasks->setChecked(configuration.readEntry("connectJobsWithTasks", false));
    m_generalUi.groupJobs->setChecked(configuration.readEntry("groupJobs", true));

    m_generalUi.jobCloseMode->addItem(i18n("Instantly"), QVariant(InstantClose));
    m_generalUi.jobCloseMode->addItem(i18n("After delay"), QVariant(DelayedClose));
    m_generalUi.jobCloseMode->addItem(i18n("Manually"), QVariant(ManualClose));
    m_generalUi.jobCloseMode->setCurrentIndex(m_generalUi.jobCloseMode->findData(QVariant(configuration.readEntry("jobCloseMode", static_cast<int>(DelayedClose)))));

    QStringList moveAnimationNames;
    moveAnimationNames << i18n("None") << i18n("Zoom") << i18n("Jump") << i18n("Spotlight") << i18n("Glow") << i18n("Fade");

    QList<AnimationType> moveAnimationIds;
    moveAnimationIds << NoAnimation << ZoomAnimation << JumpAnimation << SpotlightAnimation << GlowAnimation << FadeAnimation;

    for (int i = 0; i < moveAnimationIds.count(); ++i)
    {
        m_appearanceUi.moveAnimation->addItem(moveAnimationNames.at(i), QVariant(moveAnimationIds.at(i)));
    }

    QStringList iconAnimationNames;
    iconAnimationNames << i18n("None") << i18n("Bounce") << i18n("Zoom") << i18n("Blink") << i18n("Spotlight") << i18n("Rotate") << i18n("Glow");

    QList<AnimationType> iconAnimationIds;
    iconAnimationIds << NoAnimation << BounceAnimation << ZoomAnimation << BlinkAnimation << SpotlightAnimation << RotateAnimation << GlowAnimation;

    for (int i = 0; i < iconAnimationIds.count(); ++i)
    {
        m_appearanceUi.demandsAttentionAnimation->addItem(iconAnimationNames.at(i), QVariant(iconAnimationIds.at(i)));
        m_appearanceUi.startupAnimation->addItem(iconAnimationNames.at(i), QVariant(iconAnimationIds.at(i)));
    }

    m_appearanceUi.titleLabelMode->addItem(i18n("Never"), QVariant(NoLabel));
    m_appearanceUi.titleLabelMode->addItem(i18n("On mouse-over"), QVariant(MouseOverLabel));
    m_appearanceUi.titleLabelMode->addItem(i18n("For active icon"), QVariant(ActiveIconLabel));
    m_appearanceUi.titleLabelMode->addItem(i18n("Always"), QVariant(AlwaysShowLabel));
    m_appearanceUi.titleLabelMode->setCurrentIndex(m_appearanceUi.titleLabelMode->findData(QVariant(configuration.readEntry("titleLabelMode", static_cast<int>(AlwaysShowLabel)))));

    m_appearanceUi.activeIconIndication->addItem(i18n("None"), QVariant(NoIndication));
    m_appearanceUi.activeIconIndication->addItem(i18n("Zoom"), QVariant(ZoomIndication));
    m_appearanceUi.activeIconIndication->addItem(i18n("Glow"), QVariant(GlowIndication));
    m_appearanceUi.activeIconIndication->addItem(i18n("Fade"), QVariant(FadeIndication));
    m_appearanceUi.activeIconIndication->setCurrentIndex(m_appearanceUi.activeIconIndication->findData(QVariant(configuration.readEntry("activeIconIndication", static_cast<int>(FadeIndication)))));

    m_appearanceUi.customBackgroundImage->setUrl(KUrl(configuration.readEntry("customBackgroundImage", QString())));
    m_appearanceUi.customBackgroundImage->setFilter("image/svg+xml image/svg+xml-compressed");

    if (m_applet->location() != Plasma::Floating && (!m_applet->containment() || m_applet->containment()->objectName() != "FancyPanel")) {
        m_appearanceUi.customBackgroundImageLabel->hide();
        m_appearanceUi.customBackgroundImage->hide();
    }

    m_appearanceUi.moveAnimation->setCurrentIndex(moveAnimationIds.indexOf(static_cast<AnimationType>(configuration.readEntry("moveAnimation", static_cast<int>(GlowAnimation)))));
    m_appearanceUi.parabolicMoveAnimation->setChecked(configuration.readEntry("parabolicMoveAnimation", false));
    m_appearanceUi.demandsAttentionAnimation->setCurrentIndex(iconAnimationIds.indexOf(static_cast<AnimationType>(configuration.readEntry("demandsAttentionAnimation", static_cast<int>(BlinkAnimation)))));
    m_appearanceUi.startupAnimation->setCurrentIndex(iconAnimationIds.indexOf(static_cast<AnimationType>(configuration.readEntry("startupAnimation", static_cast<int>(BounceAnimation)))));

    m_arrangementUi.removeButton->setIcon(KIcon("go-previous"));
    m_arrangementUi.addButton->setIcon(KIcon("go-next"));
    m_arrangementUi.moveUpButton->setIcon(KIcon("go-up"));
    m_arrangementUi.moveDownButton->setIcon(KIcon("go-down"));

    KConfig kickoffConfiguration("kickoffrc", KConfig::NoGlobals);
    KConfigGroup favoritesGroup(&kickoffConfiguration, "Favorites");
    const QStringList currentEntries = configuration.readEntry("arrangement", QStringList("tasks"));
    QStringList availableEntries;
    availableEntries << i18n("--- separator ---") << i18n("--- tasks area ---") << i18n("--- jobs area ---") << "menu:/";
    availableEntries.append(favoritesGroup.readEntry("FavoriteURLs", QStringList()));

    for (int i = 0; i < currentEntries.count(); ++i)
    {
        QListWidgetItem *item = NULL;

        if (currentEntries.at(i) == "tasks")
        {
            item = new QListWidgetItem(i18n("--- tasks area ---"), m_arrangementUi.currentEntriesListWidget);
        }
        else if (currentEntries.at(i) == "jobs")
        {
            item = new QListWidgetItem(i18n("--- jobs area ---"), m_arrangementUi.currentEntriesListWidget);
        }
        else if (currentEntries.at(i) == "separator")
        {
            item = new QListWidgetItem(i18n("--- separator ---"), m_arrangementUi.currentEntriesListWidget);
        }
        else
        {
            if (hasEntry(currentEntries.at(i), false))
            {
                continue;
            }

            Launcher *launcher = m_applet->launcherForUrl(KUrl(currentEntries.at(i)));

            if (!launcher)
            {
                continue;
            }

            item = new QListWidgetItem(launcher->icon(), launcher->title(), m_arrangementUi.currentEntriesListWidget);
            item->setToolTip(launcher->launcherUrl().pathOrUrl());

            m_rules[launcher->launcherUrl().pathOrUrl()] = qMakePair(launcher->rules(), launcher->isExcluded());
        }

        m_arrangementUi.currentEntriesListWidget->addItem(item);
    }

    for (int i = 0; i < availableEntries.count(); ++i)
    {
        if (i > 0 && hasEntry(availableEntries.at(i), false))
        {
            continue;
        }

        QListWidgetItem *item = NULL;

        if (availableEntries.at(i).startsWith("--- "))
        {
            item = new QListWidgetItem(availableEntries.at(i), m_arrangementUi.availableEntriesListWidget);
        }
        else
        {
            Launcher *launcher = m_applet->launcherForUrl(KUrl(availableEntries.at(i)));

            if (!launcher)
            {
                continue;
            }

            item = new QListWidgetItem(launcher->icon(), launcher->title(), m_arrangementUi.availableEntriesListWidget);
            item->setToolTip(launcher->launcherUrl().pathOrUrl());

            m_rules[launcher->launcherUrl().pathOrUrl()] = qMakePair(launcher->rules(), launcher->isExcluded());
        }

        m_arrangementUi.availableEntriesListWidget->addItem(item);
    }

    QMap<QPair<Qt::MouseButtons, Qt::KeyboardModifiers>, IconAction> iconActions = m_applet->iconActions();
    QMap<QPair<Qt::MouseButtons, Qt::KeyboardModifiers>, IconAction>::iterator iterator;
    int i = 0;

    m_actionsUi.actionsTableWidget->setItemDelegateForColumn(0, new ActionDelegate(this));
    m_actionsUi.actionsTableWidget->setItemDelegateForColumn(1, new TriggerDelegate(this));

    for (iterator = iconActions.begin(); iterator != iconActions.end(); ++iterator)
    {
        if (iterator.key().first == Qt::NoButton)
        {
            continue;
        }

        QStringList action;

        if (iterator.key().first & Qt::LeftButton)
        {
            action.append("left");
        }

        if (iterator.key().first & Qt::MiddleButton)
        {
            action.append("middle");
        }

        if (iterator.key().first & Qt::RightButton)
        {
            action.append("right");
        }

        if (iterator.key().second & Qt::ShiftModifier)
        {
            action.append("shift");
        }

        if (iterator.key().second & Qt::ControlModifier)
        {
            action.append("ctrl");
        }

        if (iterator.key().second & Qt::AltModifier)
        {
            action.append("alt");
        }

        QTableWidgetItem *triggerItem = new QTableWidgetItem(action.join(QChar('+')));
        triggerItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);

        QTableWidgetItem *actionItem = new QTableWidgetItem(QString::number(static_cast<int>(iterator.value())));
        actionItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);

        m_actionsUi.actionsTableWidget->setRowCount(i + 1);
        m_actionsUi.actionsTableWidget->setItem(i, 0, actionItem);
        m_actionsUi.actionsTableWidget->setItem(i, 1, triggerItem);

        ++i;
    }

    moveAnimationTypeChanged(m_appearanceUi.moveAnimation->currentIndex());

    parent->addPage(generalWidget, i18n("General"), "go-home");
    parent->addPage(appearanceWidget, i18n("Appearance"), "preferences-desktop-theme");
    parent->addPage(arrangementWidget, i18n("Arrangement"), "format-list-unordered");
    parent->addPage(actionsWidget, i18n("Actions"), "configure-shortcuts");

    connect(parent, SIGNAL(applyClicked()), this, SLOT(save()));
    connect(parent, SIGNAL(okClicked()), this, SLOT(save()));
    connect(m_appearanceUi.moveAnimation, SIGNAL(currentIndexChanged(int)), this, SLOT(moveAnimationTypeChanged(int)));
    connect(m_appearanceUi.customBackgroundImage, SIGNAL(textChanged(QString)), this, SLOT(modify()));
    connect(m_arrangementUi.availableEntriesListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(availableEntriesCurrentItemChanged(int)));
    connect(m_arrangementUi.currentEntriesListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(currentEntriesCurrentItemChanged(int)));
    connect(m_arrangementUi.removeButton, SIGNAL(clicked()), this, SLOT(removeItem()));
    connect(m_arrangementUi.addButton, SIGNAL(clicked()), this, SLOT(addItem()));
    connect(m_arrangementUi.moveUpButton, SIGNAL(clicked()), this, SLOT(moveUpItem()));
    connect(m_arrangementUi.moveDownButton, SIGNAL(clicked()), this, SLOT(moveDownItem()));
    connect(m_arrangementUi.editLauncherButton, SIGNAL(clicked()), this, SLOT(editLauncher()));
    connect(m_actionsUi.actionsTableWidget, SIGNAL(clicked(QModelIndex)), this, SLOT(actionClicked(QModelIndex)));
    connect(m_actionsUi.actionsTableWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(actionSelectionChanged()));
    connect(m_actionsUi.addButton, SIGNAL(clicked()), this, SLOT(addAction()));
    connect(m_actionsUi.removeButton, SIGNAL(clicked()), this, SLOT(removeAction()));
    connect(addLauncherApplicationAction, SIGNAL(triggered()), this, SLOT(findLauncher()));
    connect(addLauncherFromFileAction, SIGNAL(triggered()), this, SLOT(addLauncher()));
    connect(addMenuLauncherMenu, SIGNAL(aboutToShow()), this, SLOT(populateMenu()));
    connect(addMenuLauncherMenu, SIGNAL(triggered(QAction*)), this, SLOT(addMenu(QAction*)));
}
Ejemplo n.º 24
0
bool LS3DatastoreXML::dbLoad(const QString &fileName, QProgressBar* progress) {
    LS3ElapsedAutoTimer timer("LS3DatastoreXML::dbLoad");
    // if a database is opened: close it!
    dbClose();

    QDomDocument doc("mydocument");
    QFile file(fileName);
    QString errorMessage;
    int errorLine;
    int errorColumn;

    if (!file.open(QIODevice::ReadOnly)) {
        emit dbError(tr("Error opening databse '%1': File could not be opened.").arg(fileName));
        return m_databaseLoaded=false;
    }
    if (!doc.setContent(&file, &errorMessage, &errorLine, &errorColumn)) {
        file.close();
        //file.close();
        emit dbError(tr("Error parsing databse '%1': %2 (line %3, column %4).").arg(fileName).arg(errorMessage).arg(errorLine).arg(errorColumn));
        return m_databaseLoaded=false;
    }
    file.close();

    QDomElement docElem = doc.documentElement();
    if (docElem.tagName()!="litsoz3database") {
        emit dbError(tr("Error in databse '%1': This is not a LitSoz 3 databse file (root element is <%2>, but should be <litsoz3database>.").arg(fileName).arg(docElem.tagName()));
        return m_databaseLoaded=false;
    }

    QDomElement n = docElem.firstChildElement("records");
    data->loadFromXML(n, progress);

    timer.showMessage("XML loaded");

    //if (keywordsdata) delete keywordsdata
    //keywordsdata = new QStringListModel(this);


    // create a stringlist model for the keywords and read its contents from the keywords field in the metadata table
    // the (possibly changed) model will be written back in the closeDB() method
    QDomElement metadata = docElem.firstChildElement("metadata");
    if (!metadata.isNull()) {
        n = metadata.firstChildElement("item");
        while(!n.isNull()) {
            QString type=n.attribute("type").toLower();
            if (type=="keywords") {
                QString sdata=n.text().replace("\r\n", "\n");
                sdata=sdata.replace("\n\r", "\n");
                sdata=sdata.replace("\n\n", "\n");
                sdata=sdata.replace("\n\n", "\n");
                sdata=sdata.replace("\r\r", "");
                QStringList sl=sdata.split("\n", QString::SkipEmptyParts);
                sl.removeDuplicates();
                sl.sort();
                keywordsdata->setStringList(sl);
            }
            if (type=="topics") {
                QString sdata=n.text().replace("\r\n", "\n");
                sdata=sdata.replace("\n\r", "\n");
                sdata=sdata.replace("\n\n", "\n");
                sdata=sdata.replace("\n\n", "\n");
                sdata=sdata.replace("\r\r", "");
                QStringList sl=sdata.split("\n", QString::SkipEmptyParts);
                sl.removeDuplicates();
                sl.sort();
                topicsdata->setStringList(sl);
            }
            n=n.nextSiblingElement("item");
        }
    }

    timer.showMessage("METADATA read");


    // read the list of selected records
    QDomElement selectedNode = docElem.firstChildElement("selection_list");
    clearSelection();
    if (!selectedNode.isNull()) {
        n = selectedNode.firstChildElement("item");
        while(!n.isNull()) {
            QString uuid=n.attribute("uuid");
            select(uuid);
            n=n.nextSiblingElement("item");
        }
    }
    timer.showMessage("SELECTION read");


    // read the reference tree

    QDomElement reftreeNode = docElem.firstChildElement("litsoz3_reference_tree");
    getReferencTreeModel()->readFromXML(reftreeNode);
    timer.showMessage("REFTREE read");

    // read the authorsdata completer list from a file in config dir
    //if (authorsdata) delete authorsdata;
    //authorsdata = new QStringListModel(this);
    QFile f(settings->GetConfigDirectory()+"/completers/authors.lst");
    if (f.open(QIODevice::ReadOnly|QIODevice::Text)) {
        //std::cout<<"OK\n";
        QString s=QString::fromUtf8(f.readAll());
        authorsdata->setStringList(s.split('\n', QString::SkipEmptyParts));
    }

    updateCompleters(0, recordCount()-1, false);
    timer.showMessage("AUTHORS_COMPLETER read");

    m_currentFile=fileName;
    emit filenameChanged(m_currentFile);
    emit connectWidgets();
    timer.showMessage("CONNECTED_WIDGETS");
    dbFirst();
    timer.showMessage("MOVED FIRST");

    emit databaseLoaded(true);
    emit databaseClosed(false);
    emit massiveSelectionChange();
    timer.showMessage("EMITED SIGNALS");
    return m_databaseLoaded=true;
}