void PixmapListDialog::setMovie( const QByteArray& image )
{
	if ( label->movie() ) delete label->movie();
	if ( movie_buffer ) delete movie_buffer;

	movie_buffer = new QBuffer();
	movie_buffer->buffer() = image;
	movie_buffer->open( QIODevice::ReadOnly );

	QMovie *pm = new QMovie( movie_buffer );

	QBuffer *movie_buffer_tmp = new QBuffer();
	movie_buffer_tmp->buffer() = image;
	movie_buffer_tmp->open( QIODevice::ReadOnly );
	QMovie *pm_tmp = new QMovie( movie_buffer_tmp );
	pm_tmp->jumpToFrame ( 0 );
	QImage background_image = pm_tmp->currentImage();
	QSize scaled_size = pm_tmp->currentImage().size();
	pm_tmp->stop();
	delete pm_tmp;
	delete movie_buffer_tmp;

	scaled_size.scale( background_label->size(), Qt::KeepAspectRatio );
	pm->setScaledSize( scaled_size );
	background_label->setPixmap( QPixmap::fromImage( background_image.scaled( scaled_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ) );
	pm->setCacheMode( QMovie::CacheAll );
	label->setMovie( pm );
	label->movie()->start();
}
예제 #2
0
ImagePreviewer::ImagePreviewer(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ImagePreviewer)
{
    cancelled = false;
    imagesCount = 0;
    multiMode = false;
    ui->setupUi(this);

    setWindowFlags(Qt::Window
                   | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint
                   | Qt::WindowMaximizeButtonHint
                   | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);

    QtWin::extendFrameIntoClientArea(this);

    QGraphicsDropShadowEffect* ds = new QGraphicsDropShadowEffect;
    ds->setColor(Qt::white);
    ds->setOffset(0,0);
    ds->setBlurRadius(4);
    ui->loaderLabel->setGraphicsEffect(ds);
    ui->statusLabel->setGraphicsEffect(ds);
    QMovie* m = new QMovie(":/resources/RES/loader.gif");
    ui->loaderLabel->setMovie(m);
    m->setCacheMode(QMovie::CacheAll);
    m->start();
    imagePreview = new QGraphicsScene;
    ui->graphicsView->setScene(imagePreview);
    ui->graphicsView->setBackgroundBrush(QPixmap(":/resources/RES/alpha.png"));
    restoreGeometry(ideSettings::getByteArray(S_IMAGEPREVIEW_GEOMETRY));
}
예제 #3
0
void AbstractItemDetail::initDialog()
{
	newNoteDialog = new CreateNoteDialog(this);
	newNoteDialog->hide();

	notesModel = new NotesModel(this);

	loading = new QLabel(this);
	QMovie *mov = new QMovie();
	mov->setCacheMode(QMovie::CacheAll);
	loading->setMovie(mov);
	mov->setFileName(":loading.gif");
	mov->setScaledSize(QSize(20, 20));
	mov->start();

	crm = SugarCrm::getInstance();

	notesTable = new QTableView(this);
	notesTable->verticalHeader()->hide();
	notesTable->horizontalHeader()->setStretchLastSection(true);
	notesTable->setSelectionBehavior(QAbstractItemView::SelectRows);
	notesTable->setSelectionMode(QAbstractItemView::SingleSelection);

	// buttons
	save = new QPushButton(QIcon(":save.png"), tr("Speichern"));
	newNote = new QPushButton(QIcon(":notes.png"), tr("Neue Notiz"));
	newDocument = new QPushButton(QIcon(":documents.png"), tr("Neues Dokument"));

	connect(save, SIGNAL(pressed()),
			this, SLOT(saveChanges()));
	connect(newNote, SIGNAL(pressed()),
			this, SLOT(showNewNoteDialog()));
	connect(newNoteDialog, SIGNAL(accepted()),
			this, SLOT(createNewNote()));
	connect(newDocument, SIGNAL(pressed()),
			this, SLOT(showNewDocumentDialog()));
	connect(notesTable, SIGNAL(doubleClicked(QModelIndex)),
			this, SLOT(downloadNoteAttachment(QModelIndex)));
}
예제 #4
0
SVNCommitDialog::SVNCommitDialog(QWidget *parent, const QString &workingDir,
                                 const QStringList &files, bool folderOnly,
                                 int sceneIconAdded)
    : Dialog(TApp::instance()->getMainWindow(), true, false)
    , m_commitSceneContentsCheckBox(0)
    , m_workingDir(workingDir)
    , m_files(files)
    , m_folderOnly(folderOnly)
    , m_targetTempFile(0)
    , m_selectionCheckBox(0)
    , m_selectionLabel(0)
    , m_sceneIconAdded(sceneIconAdded)
    , m_folderAdded(0) {
  setModal(false);
  setAttribute(Qt::WA_DeleteOnClose, true);
  setWindowTitle(tr("Version Control: Put changes"));

  if (m_folderOnly)
    setMinimumSize(320, 320);
  else
    setMinimumSize(300, 180);

  QWidget *container = new QWidget;

  QVBoxLayout *mainLayout = new QVBoxLayout;
  mainLayout->setAlignment(Qt::AlignHCenter);
  mainLayout->setMargin(0);

  m_treeWidget = new QTreeWidget;
  m_treeWidget->header()->hide();
  m_treeWidget->hide();

  if (m_folderOnly) {
    m_treeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
    m_treeWidget->setIconSize(QSize(21, 17));
  }
  m_treeWidget->setStyleSheet("QTreeWidget { border: 1px solid gray; }");

  if (m_folderOnly) {
    mainLayout->addWidget(m_treeWidget);

    QHBoxLayout *belowTreeLayout = new QHBoxLayout;
    belowTreeLayout->setMargin(0);

    m_selectionCheckBox = new QCheckBox(tr("Select / Deselect All"), 0);
    connect(m_selectionCheckBox, SIGNAL(clicked(bool)), this,
            SLOT(onSelectionCheckBoxClicked(bool)));

    m_selectionLabel = new QLabel;
    m_selectionLabel->setText(tr("0 Selected / 0 Total"));

    m_selectionCheckBox->hide();
    m_selectionLabel->hide();

    belowTreeLayout->addWidget(m_selectionCheckBox);
    belowTreeLayout->addStretch();
    belowTreeLayout->addWidget(m_selectionLabel);

    mainLayout->addLayout(belowTreeLayout);
  }

  QHBoxLayout *hLayout = new QHBoxLayout;

  m_waitingLabel      = new QLabel;
  QMovie *waitingMove = new QMovie(":Resources/waiting.gif");
  waitingMove->setParent(this);

  m_waitingLabel->setMovie(waitingMove);
  waitingMove->setCacheMode(QMovie::CacheAll);
  waitingMove->start();

  m_textLabel = new QLabel;
  m_textLabel->setText(tr("Getting repository status..."));

  hLayout->addStretch();
  hLayout->addWidget(m_waitingLabel);
  hLayout->addWidget(m_textLabel);
  hLayout->addStretch();

  mainLayout->addLayout(hLayout);

  if (!m_folderOnly)
    mainLayout->addWidget(m_treeWidget);
  else
    mainLayout->addSpacing(10);

  QFormLayout *formLayout = new QFormLayout;
  formLayout->setLabelAlignment(Qt::AlignRight);
  formLayout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
  formLayout->setSpacing(10);
  formLayout->setMargin(0);

  m_commentTextEdit = new QPlainTextEdit;
  m_commentTextEdit->setMaximumHeight(50);
  m_commentTextEdit->hide();

  m_commentLabel = new QLabel(tr("Comment:"));
  m_commentLabel->setFixedWidth(55);
  m_commentLabel->hide();

  formLayout->addRow(m_commentLabel, m_commentTextEdit);

  if (!m_folderOnly) {
    m_commitSceneContentsCheckBox = new QCheckBox(this);
    connect(m_commitSceneContentsCheckBox, SIGNAL(toggled(bool)), this,
            SLOT(onCommiSceneContentsToggled(bool)));
    m_commitSceneContentsCheckBox->setChecked(false);
    m_commitSceneContentsCheckBox->hide();
    m_commitSceneContentsCheckBox->setText(tr("Put Scene Contents"));
    formLayout->addRow("", m_commitSceneContentsCheckBox);
  }
예제 #5
0
void ChatEmoticonMenu::setEmoticons(QHash<QString, QStringList> list)
{
	clearList();
	m_widget = new QWidget;
	m_grid_layout = new QGridLayout(m_widget);
	m_grid_layout->setSpacing(1);
	m_widget->setLayout(m_grid_layout);
	int max_len_size = 0;

	m_desktop_geometry = QSize();

	QHash<int, QString> emotOrder;
	{
		QHashIterator<QString, QStringList> i(list);
		while (i.hasNext())
		{
			i.next();
			QString key = i.key();
			list.remove(key);
			int index = key.indexOf("|");
			int num = key.mid(0, index).toInt();
			key.remove(0, index+1);
			emotOrder.insert(num, key);
			list.insert(key, i.value());
		}
	}

        QHashIterator<int, QString> i(emotOrder);
	while (i.hasNext())
	{
		i.next();
		QStringList values = list.value(i.value());
		if(!values.size())
			continue;

		movieLabel *label = new movieLabel;
		labelList << label;
		QMovie *movie = new QMovie(i.value());
		movieList << movie;
		label->setMovie(movie);
		movie->setCacheMode(QMovie::CacheAll);
		movie->start();
                QSize size = movie->currentPixmap().size();
                label->setMinimumSize(size);
                sizeList << size;
		label->setToolTip(values.first());
		connect(label, SIGNAL(sendMovieTip(const QString &)), this, SIGNAL(insertSmile(const QString &)));
                label->setInsOnUp(m_insonup);
		movie->stop();
	}
//
//	int sq  = std::ceil(std::sqrt((float)list.count()));
//
//	int i = 0, j = 0;
//
//	foreach(const QString &path, emotList)
//	{
//		QStringList values = list.value(path);
//		if(!values.size())
//			continue;
//		movieLabel *l = new movieLabel;
////		QMovie *movie = new QMovie(path + "/" + list.key(name));
//		QMovie *movie = new QMovie(path);
//		movieList.append(movie);
//		l->setMovie(movie);
//		movie->setCacheMode(QMovie::CacheAll);
//		movie->start();
//		QSize movie_size = movie->currentPixmap().size();
//		l->setMinimumSize(movie_size);
//		labelList.append(l);
//		l->setToolTip(values.first());
//		connect(l, SIGNAL(sendMovieTip(const QString &)), this, SIGNAL(insertSmile(const QString &)));
//		m_grid_layout->addWidget(l,i,j);
//		if ( j < sq )
//			j++;
//		else
//		{
//			i++;
//			j = 0;
//		}
//		movie->stop();
//	}
	setWidget(m_widget);
}