コード例 #1
0
QWidget *DlgSettingsExportFormat::createSubPanel ()
{
  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createSubPanel";

  QWidget *subPanel = new QWidget ();
  QGridLayout *layout = new QGridLayout (subPanel);
  subPanel->setLayout (layout);

  int row = 0;
  createCurveSelection (layout, row);

  createTabWidget (layout,
                   row);

  QWidget *widgetMisc = new QWidget;
  layout->addWidget (widgetMisc, row++, 0, 1, 3);
  QHBoxLayout *layoutMisc = new QHBoxLayout;
  widgetMisc->setLayout (layoutMisc);

  createDelimiters (layoutMisc); // One row of radio buttons
  createHeader (layoutMisc); // Two rows with radio buttons and then header label
  createFileLayout (layoutMisc); // One row of radio buttons

  createPreview (layout, row);

  return subPanel;
}
コード例 #2
0
QWidget *DlgSettingsColorFilter::createSubPanel ()
{
  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsColorFilter::createSubPanel";

  const int EMPTY_COLUMN_WIDTH = 40;

  QWidget *subPanel = new QWidget ();
  QGridLayout *layout = new QGridLayout (subPanel);
  subPanel->setLayout (layout);

  layout->setColumnStretch(0, 0); // Empty column
  layout->setColumnMinimumWidth(0, EMPTY_COLUMN_WIDTH);
  layout->setColumnStretch(1, 0); // Radio buttons
  layout->setColumnMinimumWidth(1, 210);
  layout->setColumnStretch(2, 0); // Empty column to put some space between previous and next columns, so they are not too close
  layout->setColumnMinimumWidth(2, 15);
  layout->setColumnStretch(3, 1); // Profile
  layout->setColumnMinimumWidth(4, EMPTY_COLUMN_WIDTH); // Empty column
  layout->setColumnStretch(4, 0);

  int rowLeft = 0, rowRight = 0;
  createControls (layout, rowLeft);
  createProfileAndScale (layout, rowRight);

  int row = qMax (rowLeft, rowRight);
  createPreview (layout, row);

  return subPanel;
}
コード例 #3
0
DlgImportCroppingNonPdf::DlgImportCroppingNonPdf(const QString &fileName) :
  m_fileName (fileName),
  m_pixmap (nullptr),
  m_nonPdfCropping (nullptr)
{
  LOG4CPP_INFO_S ((*mainCat)) << "DlgImportCroppingNonPdf::DlgImportCroppingNonPdf";

  setWindowTitle (tr ("Image File Import Cropping"));
  setModal (true);

  QWidget *subPanel = new QWidget ();
  QGridLayout *layout = new QGridLayout (subPanel);
  subPanel->setLayout (layout);

  int row = 0;

  createPreview (layout, row);
  finishPanel (subPanel);
  updatePreview ();

  // Bring the two middle columns together
  layout->setColumnStretch (0, 1);
  layout->setColumnStretch (1, 0);
  layout->setColumnStretch (2, 0);
  layout->setColumnStretch (3, 1);
}
コード例 #4
0
//! Slot für das Anklicken eines Gebietes
void PrintWidget::itemClicked(QListWidgetItem* item)
{
  //! Zeiger auf das Gebiet übernehmen
  _CurrentArea = (Area*)(((DataListWidgetItem*)item)->dbItem());

  //! Methode zum Erstellen der Preview erstellen
  createPreview();
}
コード例 #5
0
ファイル: picsearch.cpp プロジェクト: JLuc/scribus
void PicSearch::foundFilesBox_clicked(QListWidgetItem *c)
{
	if (c == NULL)
		return;
	currentImage = QDir::fromNativeSeparators(c->text());
	if (previewCheckBox->isChecked())
		createPreview();
	useButton->setEnabled(true);
}
コード例 #6
0
wxThread::ExitCode PreviewGeneratorThread::Entry()
{
	while(!TestDestroy() && !terminate_)
	{
		wxImage localPreviewImage;
		PreviewInfo localPreviewInfo;

		// Wait for new job
		{
			wxMutexLocker lock(mutex_);

			while(!hasNewPreviewRequest_
				&&!terminate_)
			{
				cond_.Wait();
			}

			localPreviewInfo = previewInfoIn_;
			hasNewPreviewRequest_ = false;
		}

		if(terminate_)
			return 0;

		bool fileReadOK = true;
		bool isMatchesPreview = false;

		try
		{
			fileReadOK = createPreview(localPreviewImage, localPreviewInfo);
		}
		catch(std::exception &WXUNUSED(e))
		{
			fileReadOK = false;
		}
		catch(...)
		{
			fileReadOK = false;
		}

		// Copy preview to previewImage_
		if(fileReadOK)
		{
			{
				wxMutexLocker lock(outputMutex_);
				previewImage_ = localPreviewImage.Copy();	// Make an actual copy, not just a new reference
				previewInfoOut_ = localPreviewInfo;
				hasNewPreview_ = true;
			}
			if(pMainFrame_ !=  NULL)
				pMainFrame_->sendNewPreviewImageEvent();
		}

	}

	return 0;
}
コード例 #7
0
ファイル: picsearch.cpp プロジェクト: JLuc/scribus
void PicSearch::previewCheckBox_clicked()
{
	if (previewCheckBox->isChecked())
	{
		previewLabel->show();
		if (!currentImage.isEmpty())
			createPreview();
	}
	else
		previewLabel->hide();
}
コード例 #8
0
ファイル: ShaderSelector.cpp プロジェクト: ibrahimmusba/ufoai
// Constructor creates GTK elements
ShaderSelector::ShaderSelector(Client* client, const std::string& prefixes, bool isLightTexture) :
	_glWidget(true),
	_infoStore(gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING)),
	_client(client)
{
	// Split the given comma-separated list into the vector
	string::splitBy(prefixes, _prefixes, ",");

	// Construct main VBox, and pack in TreeView and info panel
	_widget = gtk_vbox_new(FALSE, 3);
	gtk_box_pack_start(GTK_BOX(_widget), createTreeView(), TRUE, TRUE, 0);
	gtk_box_pack_start(GTK_BOX(_widget), createPreview(), FALSE, FALSE, 0);
}
コード例 #9
0
QWidget *DlgSettingsDigitizeCurve::createSubPanel ()
{
  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsDigitizeCurve::createSubPanel";

  QWidget *subPanel = new QWidget ();
  QGridLayout *layout = new QGridLayout (subPanel);
  subPanel->setLayout (layout);

  layout->setColumnStretch (0, 1); // Empty first column
  layout->setColumnStretch (1, 0); // Labels
  layout->setColumnStretch (2, 0); // User controls
  layout->setColumnStretch (3, 1); // Empty last column

  int row = 0;
  createControls(layout, row);
  createPreview (layout, row);

  return subPanel;
}
コード例 #10
0
QWidget *DlgSettingsPointMatch::createSubPanel ()
{
  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsPointMatch::createSubPanel";

  QWidget *subPanel = new QWidget ();
  QGridLayout *layout = new QGridLayout (subPanel);
  subPanel->setLayout (layout);

  layout->setColumnStretch(0, 1); // Empty column
  layout->setColumnStretch(1, 0); // Labels
  layout->setColumnStretch(2, 0); // Controls
  layout->setColumnStretch(3, 1); // Empty column

  int row = 0;
  createControls (layout, row);
  createPreview (layout, row);
  createTemplate ();

  return subPanel;
}
コード例 #11
0
QWidget *DlgSettingsSegments::createSubPanel ()
{
  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsSegments::createSubPanel";

  QWidget *subPanel = new QWidget ();
  QGridLayout *layout = new QGridLayout (subPanel);
  subPanel->setLayout (layout);

  layout->setColumnStretch (0, 1); // Empty first column
  layout->setColumnStretch (1, 0); // Labels
  layout->setColumnStretch (2, 0); // User controls
  layout->setColumnStretch (3, 1); // Empty last column

  int row = 0;
  createControls(layout, row);
  createPreview (layout, row);
  QPixmap pixmap = QPixmap::fromImage (createPreviewImage());
  m_scenePreview->addPixmap (pixmap);

  return subPanel;
}
コード例 #12
0
QWidget *DlgSettingsGridRemoval::createSubPanel ()
{
  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::createSubPanel";

  const int COLUMN_CHECKBOX_WIDTH = 60;

  QWidget *subPanel = new QWidget ();
  QGridLayout *layout = new QGridLayout (subPanel);
  subPanel->setLayout (layout);

  layout->setColumnStretch(0, 1); // Empty first column
  layout->setColumnStretch(1, 0); // Checkbox part of "section" checkboxes. In other rows this has empty space as indentation
  layout->setColumnMinimumWidth(1, COLUMN_CHECKBOX_WIDTH);
  layout->setColumnStretch(2, 0); // X
  layout->setColumnStretch(3, 0); // Y
  layout->setColumnStretch(4, 1); // Empty last column

  int row = 0;
  createRemoveGridLines (layout, row);
  createPreview (layout, row);

  return subPanel;
}
コード例 #13
0
void EditFile::showFiles()
{
    QString s = edtFile->text();
#ifdef WIN32
    s.replace(QRegExp("\\\\"), "/");
#endif
    if (bDirMode){
        s = QFileDialog::getExistingDirectory(s, topLevelWidget(), title);
    }else if (bMultiplyMode){
        QStringList lst = QFileDialog::getOpenFileNames(filter, QString::null, topLevelWidget());
        if ((lst.count() > 1) || ((lst.count() > 0) && (lst[0].find(' ') >= 0))){
            for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it){
                *it = QString("\"") + *it + QString("\"");
            }
        }
        s = lst.join(" ");
    }else{
        if (s.isEmpty()){
            s = startDir;
            if (!s.isEmpty()){
                string d;
                d = QFile::encodeName(s);
                makedir((char*)d.c_str());
            }
        }
        if (createPreview){
            FileDialog *dlg = new FileDialog( s, filter, topLevelWidget(), title.isEmpty() ? i18n("Open") : title);
            if ( topLevelWidget()->icon() && !topLevelWidget()->icon()->isNull()){
                dlg->setIcon( *topLevelWidget()->icon() );
            }else if (qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull()){
                dlg->setIcon( *qApp->mainWidget()->icon() );
            }
            FilePreview *preview = createPreview(dlg);
#ifdef USE_KDE
            dlg->setOperationMode( KFileDialog::Opening);
            if (preview)
                dlg->setPreviewWidget(preview);
#else
            dlg->setMode( QFileDialog::ExistingFile );
            if (preview){
                dlg->setContentsPreview(preview, preview);
                dlg->setContentsPreviewEnabled(true);
                dlg->setPreviewMode(QFileDialog::Contents);
            }
#endif
            dlg->setFilter(filter);
            QString result;
            s = "";
            if (dlg->exec() == QDialog::Accepted){
                s = dlg->selectedFile();
            }
            delete dlg;
        }else{
#ifdef USE_KDE
            if (title.isEmpty()){
                s = QFileDialog::getOpenFileName(s, filter, topLevelWidget());
            }else{
                s = QFileDialog::getOpenFileName(s, filter, topLevelWidget(), title);
            }
#else
            s = QFileDialog::getOpenFileName(s, filter, topLevelWidget(), "filedialog", title);
#endif
        }
    }
#ifdef WIN32
    s.replace(QRegExp("/"), "\\");
#endif
    if (s.length()) edtFile->setText(s);
}
コード例 #14
0
ファイル: MmalStillCamera.cpp プロジェクト: hairu/freelss
void MmalStillCamera::initialize(CameraMode cameraMode)
{
	m_resolution = MmalUtil::get()->getClosestResolution(m_name, cameraMode);

	if (m_imageWidth != -1)
	{
		throw Exception("Camera is already initialized");
	}

	m_imageWidth = m_resolution.width;
	m_imageHeight = m_resolution.height;

	m_callbackData = new MmalStillCallbackData(m_imageWidth, m_imageHeight, 3);

	// Handle the sensor properties
	real sensorWidth, sensorHeight, focalLength;
	MmalUtil::get()->getSensorProperties(m_name, sensorWidth, sensorHeight, focalLength);
	setSensorProperties(sensorWidth, sensorHeight, focalLength);

	createCameraComponent();
	InfoLog << "Created camera" << Logger::ENDL;

	createPreview();
	InfoLog << "Created preview" << Logger::ENDL;

	InfoLog << "Target Image Width: " << VCOS_ALIGN_UP(m_imageWidth, 32) << Logger::ENDL;
	InfoLog << "Target Image Height: " << VCOS_ALIGN_UP(m_imageHeight, 16) << Logger::ENDL;

	MMAL_STATUS_T status;

	m_targetPort = m_stillPort;

	// Create pool of buffer headers for the output port to consume
	m_pool = mmal_port_pool_create(m_targetPort, m_targetPort->buffer_num, m_targetPort->buffer_size);
	if (m_pool == NULL)
	{
		throw Exception("Failed to create buffer header pool for encoder output port");
	}

	MMAL_CONNECTION_T *preview_connection = NULL;
	status = connect_ports(m_previewPort, m_preview->input[0], &preview_connection);
	if (status != MMAL_SUCCESS)
	{
		throw Exception("Error connecting preview port");
	}

	m_targetPort->userdata = (struct MMAL_PORT_USERDATA_T *) m_callbackData;
	m_callbackData->image = NULL;
	m_callbackData->pool = m_pool;

	// Enable the encoder output port and tell it its callback function
	if (mmal_port_enable(m_targetPort, EncoderBufferCallback) != MMAL_SUCCESS)
	{
		ErrorLog << "Error enabling the encoder buffer callback" << Logger::ENDL;
	}

	// Send all the buffers to the encoder output port
	int num = mmal_queue_length(m_pool->queue);
	for (int q = 0; q < num; q++)
	{
		MMAL_BUFFER_HEADER_T *buffer = mmal_queue_get(m_pool->queue);

		if (buffer == NULL)
		{
			ErrorLog << "Unable to get buffer " << q << " from the pool" << Logger::ENDL;
		}

		if (mmal_port_send_buffer(m_targetPort, buffer) != MMAL_SUCCESS)
		{
			ErrorLog << "Unable to send a buffer " << q << " to encoder output port " << Logger::ENDL;
		}
	}

	// Enable burst mode
	if (m_burstModeEnabled)
	{
		if (mmal_port_parameter_set_boolean(m_camera->control,  MMAL_PARAMETER_CAMERA_BURST_CAPTURE, 1) != MMAL_SUCCESS)
		{
			ErrorLog << "Error enabling burst mode" << Logger::ENDL;
		}

		InfoLog << "Enabled burst mode for still images" << Logger::ENDL;
	}

	InfoLog << "Initialized camera" << Logger::ENDL;
}
コード例 #15
0
MmalStillCamera::MmalStillCamera(int imageWidth, int imageHeight, bool enableBurstMode) :
	m_imageWidth(imageWidth),
	m_imageHeight(imageHeight),
	m_callbackData(NULL),
	m_cs(),
	m_camera(NULL),
	m_preview(NULL),
	m_encoder(NULL),
	m_pool(NULL),
	m_previewPort(NULL),
	m_videoPort(NULL),
	m_stillPort(NULL),
	m_targetPort(NULL)
{
	m_callbackData = new MmalStillCallbackData(m_imageWidth, m_imageHeight, 3);

	createCameraComponent();
	std::cout << "Created camera" << std::endl;

	createPreview();
	std::cout << "Created preview" << std::endl;

	std::cout << "Target Image Width: " << VCOS_ALIGN_UP(m_imageWidth, 32) << std::endl;
	std::cout << "Target Image Height: " << VCOS_ALIGN_UP(m_imageHeight, 16) << std::endl;

	MMAL_STATUS_T status;

	m_targetPort = m_stillPort;

	// Create pool of buffer headers for the output port to consume
	m_pool = mmal_port_pool_create(m_targetPort, m_targetPort->buffer_num, m_targetPort->buffer_size);
	if (m_pool == NULL)
	{
		throw Exception("Failed to create buffer header pool for encoder output port");
	}

	MMAL_CONNECTION_T *preview_connection = NULL;
	status = connect_ports(m_previewPort, m_preview->input[0], &preview_connection);
	if (status != MMAL_SUCCESS)
	{
		throw Exception("Error connecting preview port");
	}

	m_targetPort->userdata = (struct MMAL_PORT_USERDATA_T *) m_callbackData;
	m_callbackData->image = NULL;
	m_callbackData->pool = m_pool;

	// Enable the encoder output port and tell it its callback function
	if (mmal_port_enable(m_targetPort, EncoderBufferCallback) != MMAL_SUCCESS)
	{
		std::cerr << "Error enabling the encoder buffer callback" << std::endl;
	}

	// Send all the buffers to the encoder output port
	int num = mmal_queue_length(m_pool->queue);
	for (int q = 0; q < num; q++)
	{
		MMAL_BUFFER_HEADER_T *buffer = mmal_queue_get(m_pool->queue);

		if (buffer == NULL)
		{
			std::cerr << "Unable to get buffer " << q << " from the pool" << std::endl;
		}

		if (mmal_port_send_buffer(m_targetPort, buffer)!= MMAL_SUCCESS)
		{
			std::cerr << "Unable to send a buffer " << q << " to encoder output port " << std::endl;
		}
	}

	// Enable burst mode
	if (enableBurstMode)
	{
		if (mmal_port_parameter_set_boolean(m_camera->control,  MMAL_PARAMETER_CAMERA_BURST_CAPTURE, 1) != MMAL_SUCCESS)
		{
			std::cerr << "Error enabling burst mode" << std::endl;
		}

		std::cout << "Enabled burst mode for still images" << std::endl;
	}

	std::cout << "Initialized camera" << std::endl;
}
コード例 #16
0
void QgsAttributeTypeLoadDialog::previewButtonPushed()
{
  createPreview( valueComboBox->currentIndex(), true );
}
コード例 #17
0
//==============================================================================
// Create MainWindow
//==============================================================================
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    bgColor (QColor(255,255,255)),
    logoPath(logoDefaultPath),
    usbPath (usbDefaultPath),
    rdPath  (rdDefaultPath)
{
    ui->setupUi(this);
    setAttribute(Qt::WA_DeleteOnClose);
    setWindowTitle("BootLogo Changer for Maemo 5");

    shell = 0;

    rdShow = false;

    QMenuBar *menu = menuBar();
    enableAnySizes = new QAction("Allow any image sizes", this);
    enableAnySizes->setCheckable(true);
    connect(enableAnySizes, SIGNAL(triggered(bool)),
            this, SLOT(changeImageLimit(bool)));
    menu->addAction(enableAnySizes);
    menu->addAction("About", this, SLOT(showAbout()));
    menu->addAction("About Qt", qApp, SLOT(aboutQt()));

    ui->stack->setCurrentWidget(ui->centralPage);

    // Central/Left/Right layouts
    ui->rightTopLayout->setContentsMargins(sizeInc, 0, 0, 0);

    // Right buttons
    // Background button
    ui->bgButton->setFixedWidth(ui->bgButton->sizeHint().width() + sizeStep);
    connect(ui->bgButton, SIGNAL(clicked()), this, SLOT(bgBtnClicked()));
    ui->bgButton->installEventFilter(this);
    ui->rightTopLayout->setAlignment(ui->bgButton, Qt::AlignVCenter | Qt::AlignRight);
    // Logo button
    ui->logoButton->setFixedWidth(ui->bgButton->sizeHint().width() + sizeStep);
    connect(ui->logoButton, SIGNAL(clicked()), this, SLOT(logoBtnClicked()));
    ui->logoButton->installEventFilter(this);
    ui->rightTopLayout->setAlignment(ui->logoButton, Qt::AlignVCenter | Qt::AlignRight);
    // USB button
    ui->usbButton->setFixedWidth(ui->bgButton->sizeHint().width() + sizeStep);
    connect(ui->usbButton, SIGNAL(clicked()), this, SLOT(usbBtnClicked()));
    ui->usbButton->installEventFilter(this);
    ui->rightTopLayout->setAlignment(ui->usbButton, Qt::AlignVCenter | Qt::AlignRight);
    // RD button
    ui->rdButton->setFixedWidth(ui->bgButton->sizeHint().width() + sizeStep);
    connect(ui->rdButton, SIGNAL(clicked()), this, SLOT(rdBtnClicked()));
    ui->rdButton->installEventFilter(this);
    ui->rightTopLayout->setAlignment(ui->rdButton, Qt::AlignVCenter | Qt::AlignRight);
    // Preview button
    connect(ui->previewButton, SIGNAL(clicked()), this, SLOT(showPreview()));
    // Apply button
    connect(ui->applyButton, SIGNAL(clicked()), this, SLOT(applyBtnClicked()));

    // Create info widgets for buttons
    // Create Background info widget
    createBgInfo();
    // Create Logo info widget
    createLogoInfo();
    // Create USB info widget
    createUsbInfo();
    // Create RD info widget
    createRdInfo();
    // Create Preview widget
    createPreview();
    // Create Apply widget
    createApply();
}