Exemple #1
0
DeviceWidget::DeviceWidget(QWidget *parent, QString devnode) : QWidget(parent), ui(new Ui::DeviceWidget){
  ui->setupUi(this); //load the designer file
  isMounted = false; //default value
  autoplay = true; //default value
  WAct = new QWidgetAction(this);
    WAct->setDefaultWidget(this);
  ui->label_dev->setWhatsThis(devnode);
  connect(ui->tool_run, SIGNAL(clicked()), this, SLOT(runButtonClicked()) );
  connect(ui->tool_mount, SIGNAL(clicked()), this, SLOT(mountButtonClicked()) );
  connect(ui->check_auto, SIGNAL(clicked(bool)), this, SLOT(changeAutoMount(bool)) );
  connect(ui->tool_tray, SIGNAL(clicked()), this, SLOT(OpenTrayClicked()) );
	
}
Exemple #2
0
Runner::Runner(QWidget *parent, QStatusBar* mainWindowStatusBar)
:   QWidget(parent),
    statusBar(mainWindowStatusBar)
{

    layout = new QHBoxLayout(this);



    runButton = new QPushButton(RUN);

    QFontMetrics fontMetrics = runButton->fontMetrics();

    runButton->setMinimumWidth(fontMetrics.width(RUNNING)*1.5);

    runButton->setFocusPolicy(Qt::StrongFocus);

    connect(runButton, SIGNAL(clicked()), SLOT(runButtonClicked()));

    layout->addStretch(1);

    layout->addWidget(runButton);

    layout->addStretch(1);


    processManager = new ProcessManager(this);

    converter = new ConvertAllEps(this, mainWindowStatusBar);

    pdf_concat = new ConcatPdfs(this);


    connect(processManager, SIGNAL(runFinished(bool,QString)), SLOT(onRunFinished(bool,QString)));

    connect(processManager, SIGNAL(runStarted()), SLOT(onRunStarted()));

    connect(converter, SIGNAL(finished(bool)), SLOT(onConversionFinished(bool)));

    connect(pdf_concat, SIGNAL(finished(bool)), SLOT(onConcatFinished(bool)));
}
Exemple #3
0
ButtonBar::ButtonBar(QWidget *parent) : QWidget(parent)
{
    controller = new ButtonController();
    QHBoxLayout *layout = new QHBoxLayout();

    runButton = new QPushButton();
    runButton->setText("Run");
    runButton->setMaximumSize(50, 22);
    runButton->setMinimumSize(50, 22);
    QPixmap pix(":/Images/Images/RunButtonIcon.png");
    QIcon icon(pix);
    runButton->setIcon(icon);
    runButton->setIconSize(pix.size());

    buildButton = new QPushButton();
    buildButton->setText("Build");
    buildButton->setMaximumSize(50, 22);
    buildButton->setMinimumSize(50, 22);
    QPixmap pix2(":/Images/Images/BuildButtonIcon.png");
    QIcon icon2(pix2);
    buildButton->setIcon(icon2);
    buildButton->setIconSize(pix2.size());

    connect(runButton, SIGNAL(released()), this, SLOT(runButtonClicked()));
    connect(buildButton, SIGNAL(released()), this, SLOT(buildButtonClicked()));

    layout->addWidget(runButton);
    layout->addWidget(buildButton);
    layout->setContentsMargins(5, 5, 0, 5);
    layout->setAlignment(Qt::AlignLeft);
    setLayout(layout);

    QPalette Pal(palette());
    Pal.setColor(QPalette::Background, "#323232");
    setAutoFillBackground(true);
    setPalette(Pal);

    //background color for all buttons inside the buttonbar
    setStyleSheet("QPushButton { color: white; background-color: #2D2D2F; border: none; border-color: black; } QPushButton:hover{ background-color: #1E1E1F; } QPushButton:pressed{ border-left: 2px solid grey; border-top: 2px solid grey; border-right: 2px solid black; border-bottom: 2px solid black; }");
}
/*
 *  Initialize dialog window.
 */
void
MultiShot::initialize()
{
    /*
     *  Pages.
     */
    exposureBracketingPage = getExposureBracketingPage();
    focusBracketingPage = getFocusBracketingPage();
    intervalsPage = getIntervalsPage();
    stitchPage = getStitchPage();

    tabWidget = new QTabWidget();
    tabWidget->addTab( exposureBracketingPage, tr("Exposure bracketing") );
    tabWidget->addTab( focusBracketingPage, tr("Focus bracketing") );
    tabWidget->addTab( intervalsPage, tr("Intervals") );
    tabWidget->addTab( stitchPage, tr("Panorama") );
    tabWidget->setCurrentIndex( 0 );
    QObject::connect(
	tabWidget, SIGNAL(currentChanged(int)),
	this, SLOT(updateChecklist()) );

    /*
     *  Buttons.
     */
    QPushButton *checklistButton = new QPushButton( tr("Checklist") );
    checklistButton->setIcon(
	QIcon(":/Resources/Misc/checklist.png") );
    QObject::connect(
	checklistButton, SIGNAL(clicked()),
	this, SLOT(checklistButtonClicked()) );

    runButton = new QPushButton( tr("Run") );
    QObject::connect(
	runButton, SIGNAL(clicked()),
	this, SLOT(runButtonClicked()) );

    stopButton = new QPushButton( tr("Stop") );
    stopButton->setEnabled( false );
    QObject::connect(
	stopButton, SIGNAL(clicked()),
	this, SLOT(stopButtonClicked()) );

    QPushButton *closeButton = new QPushButton( tr("Close") );
    closeButton->setDefault( true );
    QObject::connect(
	closeButton, SIGNAL(clicked()),
	this, SLOT(close()) );

    /*
     *  Final layout.
     */
    QHBoxLayout *buttonLayout = new QHBoxLayout();
    buttonLayout->addWidget( checklistButton );
    buttonLayout->addStretch();
    buttonLayout->addWidget( runButton );
    buttonLayout->addWidget( stopButton );
    buttonLayout->addWidget( closeButton );

    QVBoxLayout *layout = new QVBoxLayout( this );
    layout->addWidget( tabWidget );
    layout->addLayout( buttonLayout );
    setLayout( layout );
}
Exemple #5
0
// == PRIVATE FUNCTIONS ==
void DeviceWidget::doUpdate(){
  bool firstrun = type().isEmpty();
  //qDebug() << "Update Item:" << firstrun << quickupdates << node();
  if(firstrun || !quickupdates){
    QStringList info = pcbsd::Utils::runShellCommand("pc-sysconfig \"devinfo "+node()+"\"").join("").split(", ");
    if(info.length() < 3){ emit RefreshDeviceList(); return; } //invalid device - will probably get removed here in a moment
    //Info Output: <filesystem>, <label>, <type>
    //qDebug() << " - info:" << info;
    //Save this into the internal variables
    ui->label_icon->setWhatsThis(info[2]); //type
    ui->label_dev->setText(info[1]); //label
    ui->tool_mount->setWhatsThis(info[0]); //filesystem
    if(info[0].toLower()=="zfs"){ ui->label_icon->setToolTip(node()+" ("+info[0]+")"); }
    else{ ui->label_icon->setToolTip("/dev/"+node()+" ("+info[0]+")"); }
    //Now go through and set all the various icons and such
    QString icon = ":icons/%1.png";
    if(type()=="SATA"){ icon = icon.arg("harddrive"); }
    else if(type()=="USB"){ icon = icon.arg("usb"); }
    else if(type()=="SD"){ icon = icon.arg("sdcard"); }
    else if(type()=="CD-AUDIO"){ icon = icon.arg("musiccd"); }
    else if(type()=="CD-VIDEO"){ icon = icon.arg("cd-video"); }
    else if(type().startsWith("CD")){ icon = icon.arg("cd-generic"); }
    else if(type()=="ISO"){ icon = icon.arg("dvd"); }
    else{ icon = icon.arg("CDdevices"); }
    if(filesystem()=="NONE" && !type().startsWith("CD")){
      //Add the question-mark overlay to the icon, signifying that it is an unknown filesystem
      QPixmap tmp(icon);
      QPixmap overlay(":icons/question-overlay.png");
      QPainter paint(&tmp);
	    paint.drawPixmap(ui->label_icon->width()-20, ui->label_icon->height()-20, overlay ); //put it in the bottom-right corner
      ui->label_icon->setPixmap(tmp);
    }else{
      //Just the normal icon
      ui->label_icon->setPixmap(QPixmap(icon));
    }
    if(type()=="CD-AUDIO" || type()=="CD-VIDEO"){ 
      ui->tool_run->setIcon(QIcon(":icons/play.png")); 
      ui->tool_run->setText(tr("Play"));
    }else{ 
      ui->tool_run->setIcon(QIcon(":icons/folder.png") ); 
      ui->tool_run->setText(tr("Browse"));
    }
    ui->tool_tray->setVisible(type().startsWith("CD")); //This is a CD tray
    canmount = filesystem()!="NONE" || !type().startsWith("CD"); //has a detected filesystem or is not a CD
    ui->tool_mount->setVisible(canmount);
    ui->check_auto->setVisible(canmount && !type().startsWith("CD"));
  }
  
  //Update the status of the mount button (TO DO - special ISO handling)
  if(isMounted){
    ui->tool_mount->setText(tr("Unmount"));
    ui->tool_mount->setIcon(QIcon(":icons/eject.png"));	
    QString devsize = pcbsd::Utils::runShellCommand("pc-sysconfig \"devsize "+node()+"\"").join("");
    if(devsize.contains("??")){ 
      ui->progressBar->setRange(0,0);
    }else{
       ui->progressBar->setRange(0,100);
       ui->progressBar->setValue(devsize.section("(",1,1).section("%",0,0).toInt());
       ui->progressBar->setToolTip(devsize);
    }
  }else{
    ui->tool_mount->setText(tr("Mount"));
    ui->tool_mount->setIcon(QIcon(":icons/mount.png"));
  }
  ui->label_icon->setEnabled(isMounted || !canmount);
  ui->tool_run->setVisible( (isMounted && !mountpoint().isEmpty()) || type()=="CD-AUDIO" || type()=="CD-VIDEO" ); //if it is mounted, it can also be run
  ui->progressBar->setVisible(isMounted && ui->progressBar->maximum()==100);
  
  
  if(firstrun){
    if(canmount && !type().startsWith("CD") ){
      //Load auto-mount database and act appropriately
      QString AMFILE = QDir::homePath() + "/.pc-automounttray";
      if(QFile::exists(AMFILE)){
        QString cmd = "cat "+AMFILE;
        QString search = label() +" "+ type()+" "+ filesystem();
        bool amount = !pcbsd::Utils::runShellCommandSearch(cmd, search).isEmpty();
	ui->check_auto->setChecked(amount);
        if(amount){
	  mountButtonClicked();
	  if(isMounted){
	    emit ShowMessage(tr("Device Mounted"), QString(tr("%1 has been automatically mounted on %2")).arg(label(), mountpoint()) );
	    runButtonClicked(); //also open the directory
	  }
	}
      }
    }else if(canmount){
      //This is some kind of optical disk that can also be mounted (Blueray/DVD, or data disk for instance)
      if(type()!="CD-DATA"){ runButtonClicked(); } //not a pure data disk - go ahead and prompt to run it
    }else if(autoplay){
      //Always try to "play" a non-mountable device when it is first connected (AUDIO/VIDEO CD usually)
      runButtonClicked();
    }
  }
  
}