MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    webView = new QWebView();
    webView->setWindowTitle("contentEditor preview");
    webView->setWindowFlags(Qt::WindowStaysOnTopHint); // | Qt::FramelessWindowHint

    pageHandler::loadPages();
    pageHandler::treeWidget = ui->pagesList;
    pageHandler::pageStack = ui->pageStack;
    pageHandler::webView = webView;
    pageHandler::setup();

    setGeometry(50, 50, 1200, 700);

    connect(ui->savePage,SIGNAL(triggered()),pageHandler::getSingleton(), SLOT(savePage()));
    connect(ui->togglePagesList,SIGNAL(triggered()),this, SLOT(togglePagesList()));
    connect(ui->toggleFullscreen,SIGNAL(triggered()),this, SLOT(toggleFullscreen()));
    connect(ui->togglePreview,SIGNAL(triggered()),this, SLOT(togglePreview()));
    connect(ui->newPage,SIGNAL(triggered()),this, SLOT(addPage()));
    connect(ui->newField,SIGNAL(triggered()),this, SLOT(addField()));
    connect(ui->backgroundColor, SIGNAL(triggered()), pageHandler::getSingleton(), SLOT(setFieldBackgroundColor()));
    connect(ui->addImage, SIGNAL(triggered()), pageHandler::getSingleton(), SLOT(addImage()));
    connect(ui->toggleText, SIGNAL(triggered()), pageHandler::getSingleton(), SLOT(toggleTextEdit()));
    connect(ui->pageBackgroundColor, SIGNAL(triggered()), pageHandler::getSingleton(), SLOT(setPageBackgroundColor()));
    connect(ui->printPDF, SIGNAL(triggered()), pageHandler::getSingleton(), SLOT(exportPDF()));


    lastWebViewGeometry = QRect(200,200,500,400);
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: togglePagesList((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 1: togglePagesList(); break;
        case 2: toggleFullscreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 3: toggleFullscreen(); break;
        case 4: togglePreview((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 5: togglePreview(); break;
        case 6: onPreviewHide(); break;
        case 7: addPage(); break;
        case 8: addField(); break;
        default: ;
        }
        _id -= 9;
    }
    return _id;
}
Exemple #3
0
PreviewWindow::PreviewWindow(QWidget *proxyParent, MainWindow *parent, const QGLFormat &format)
: QGLWidget(new CoreProfileContext(format), proxyParent),
  _parent(*parent),
  _scene(parent->scene()),
  _selection(parent->selection()),
  _mousePriorities(DefaultPriorities),
  _rebuildMeshes(false)
{
    setMouseTracking(true);
    setFocusPolicy(Qt::ClickFocus);

    new QShortcut(QKeySequence("A"), this, SLOT(toggleSelectAll()));
    new QShortcut(QKeySequence("G"), this, SLOT(grabGizmo()));
    new QShortcut(QKeySequence("Ctrl+C"), this, SLOT(recomputeCentroids()));
    new QShortcut(QKeySequence("Ctrl+R"), this, SLOT(computeSmoothNormals()));
    new QShortcut(QKeySequence("Ctrl+Shift+R"), this, SLOT(computeHardNormals()));
    new QShortcut(QKeySequence("Ctrl+F"), this, SLOT(freezeTransforms()));
    new QShortcut(QKeySequence("Ctrl+D"), this, SLOT(duplicateSelection()));
    new QShortcut(QKeySequence("Ctrl+A"), this, SLOT(addModel()));
    new QShortcut(QKeySequence("Delete"), this, SLOT(deleteSelection()));
    new QShortcut(QKeySequence("Ctrl+Tab"), this, SLOT(togglePreview()));

    QShortcut *tShortcut = new QShortcut(QKeySequence("W"), this);
    QShortcut *rShortcut = new QShortcut(QKeySequence("E"), this);
    QShortcut *sShortcut = new QShortcut(QKeySequence("R"), this);
    QShortcut *xShortcut = new QShortcut(QKeySequence("X"), this);
    QShortcut *yShortcut = new QShortcut(QKeySequence("Y"), this);
    QShortcut *zShortcut = new QShortcut(QKeySequence("Z"), this);
    QShortcut *lShortcut = new QShortcut(QKeySequence("Q"), this);

    QSignalMapper *gizmoMapper = new QSignalMapper();
    connect(tShortcut, SIGNAL(activated()), gizmoMapper, SLOT(map()));
    connect(rShortcut, SIGNAL(activated()), gizmoMapper, SLOT(map()));
    connect(sShortcut, SIGNAL(activated()), gizmoMapper, SLOT(map()));
    gizmoMapper->setMapping(tShortcut, 0);
    gizmoMapper->setMapping(rShortcut, 1);
    gizmoMapper->setMapping(sShortcut, 2);
    connect(gizmoMapper, SIGNAL(mapped(int)), &_gizmo, SLOT(setMode(int)));

    gizmoMapper = new QSignalMapper();
    connect(xShortcut, SIGNAL(activated()), gizmoMapper, SLOT(map()));
    connect(yShortcut, SIGNAL(activated()), gizmoMapper, SLOT(map()));
    connect(zShortcut, SIGNAL(activated()), gizmoMapper, SLOT(map()));
    gizmoMapper->setMapping(xShortcut, 0);
    gizmoMapper->setMapping(yShortcut, 1);
    gizmoMapper->setMapping(zShortcut, 2);
    connect(gizmoMapper, SIGNAL(mapped(int)), &_gizmo, SLOT(fixAxis(int)));
    connect(lShortcut, SIGNAL(activated()), &_gizmo, SLOT(toggleTranslateLocal()));
    connect(&_gizmo, SIGNAL(redraw()), this, SLOT(updateGL()));
    connect(&_gizmo, SIGNAL(transformFinished(Mat4f)), this, SLOT(transformFinished(Mat4f)));
}
Exemple #4
0
void Advanced::prepareUi()
{
    Selection *s = new Selection(this);

    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openRaster()));
    connect(ui->actionSave_Reprojection, SIGNAL(triggered()), this, SLOT(saveReprojection()));
    connect(ui->actionSelection_Screen, SIGNAL(triggered()), s, SLOT(showSelection()));
    connect(ui->actionSelection_Screen, SIGNAL(triggered()), this, SLOT(close()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));
    connect(ui->actionLoad_Projection_Info, SIGNAL(triggered()), this, SLOT(loadParams()));
    connect(ui->actionSave_Projection_Info, SIGNAL(triggered()), this, SLOT(saveParams()));
    connect(ui->actionToggle_Preview, SIGNAL(triggered()), this, SLOT(togglePreview()));
    connect(ui->actionAbout_dRasterBlaster, SIGNAL(triggered()), s, SLOT(about()));
    connect(ui->actionAbout_Qt, SIGNAL(triggered()), s, SLOT(aboutQt()));
    connect(ui->actionEdit_Author, SIGNAL(triggered()), s, SLOT(showEditAuthor()));
    connect(ui->actionUser_Guide, SIGNAL(triggered()), s, SLOT(showUserGuide()));
    connect(ui->fillEnable, SIGNAL(stateChanged(int)), this, SLOT(fillEnable(int)));
    connect(ui->noDataValueEnable, SIGNAL(stateChanged(int)), this, SLOT(noDataEnable(int)));

    //Validators
    QIntValidator *intValid = new QIntValidator(this);
    intValid->setBottom(0);

    QDoubleValidator *doubleValid = new QDoubleValidator(this);
    doubleValid->setNotation(QDoubleValidator::StandardNotation);
    doubleValid->setBottom(0.0);

    ui->Rows->setValidator(intValid);
    ui->Cols->setValidator(intValid);
    ui->FillValue->setValidator(intValid);
    ui->noDataValue->setValidator(intValid);
    ui->pixelSize->setValidator(doubleValid);

    //projections p;
    //p.callGenerate(_UTM);
    //ui->tabProjectionInfo->setLayout(p.projVLayout);
}
ImportList::ImportList(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ImportList), selectedFile(NULL)
{
    ui->setupUi(this);

    //Set up preview table
    ui->twPreview->setHidden(true);
    ui->pbRefresh->setHidden(true);

    connect(ui->gbPreview, SIGNAL(clicked()), this, SLOT(togglePreview()));
    connect(ui->pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
    connect(ui->pbImport, SIGNAL(clicked()), this, SLOT(import()));

    //Browse File and Preview Related
    connect(ui->pbBrowse, SIGNAL(clicked()), this, SLOT(browseListFile()));
    connect(ui->leFilePath, SIGNAL(editingFinished()), this, SLOT(reloadSelectedFile()));
    connect(ui->leFilePath, SIGNAL(returnPressed()), this, SLOT(reloadSelectedFile()));
    connect(ui->pbRefresh, SIGNAL(clicked()), this, SLOT(reloadSelectedFile()));

    //Column Management Related
    connect(ui->pbAdd, SIGNAL(clicked()), this, SLOT(addSelectedColumns()));
    connect(ui->pbRemove, SIGNAL(clicked()), this, SLOT(removeSelectedColumns()));
    connect(ui->pbMoveUp, SIGNAL(clicked()), this, SLOT(moveSelectedUp()));
    connect(ui->pbMoveDown, SIGNAL(clicked()), this, SLOT(moveSelectedDown()));


    QListWidgetItem *item = new QListWidgetItem("Name", ui->lwAvailableColumns);
    item->setToolTip("Movie Title; Can contain any character");
    item->setData(Qt::UserRole, QVariant::fromValue(UserRoleData(QString("\"(.*)\""), UserRoleData::Name)));
    ui->lwAvailableColumns->addItem(item);

    item = new QListWidgetItem("Year", ui->lwAvailableColumns);
    item->setToolTip("Year when the movie came out; format: YYYY");
    item->setData(Qt::UserRole, QVariant::fromValue(UserRoleData(QString("([0-9]*)"), UserRoleData::Year)));
    ui->lwAvailableColumns->addItem(item);

    item = new QListWidgetItem("Quality", ui->lwAvailableColumns);
    item->setToolTip("Should be one of the following string: \"Xvid\", \"BDRIP\", \"720p\", or \"1080p\"");
    item->setData(Qt::UserRole, QVariant::fromValue(UserRoleData(QString("\"(.*)\""), UserRoleData::Quality)));
    ui->lwAvailableColumns->addItem(item);

    item = new QListWidgetItem("IMDB Link", ui->lwAvailableColumns);
    item->setToolTip("Valid link to IMDB Page.");
    item->setData(Qt::UserRole, QVariant::fromValue(UserRoleData(QString("\"(.*)\""), UserRoleData::IMDB)));
    ui->lwAvailableColumns->addItem(item);

    QStringList selectedColumns;
    m_settings.beginGroup(IMPORT_GROUP);

    int size = m_settings.beginReadArray(SELECTED_COLUMNS_ARRAY);
    for(int i = 0; i < size; i++)
    {
        m_settings.setArrayIndex(i);
        selectedColumns.push_front(m_settings.value(SELECTED_COLUMNS_COLUMN_KEY).toString());
    }
    m_settings.endArray();

    ui->leFilePath->setText(m_settings.value(LAST_SELECTED_FILE_KEY).toString());
    reloadSelectedFile();

    m_settings.endGroup();

    QStringList::iterator itr = selectedColumns.begin();
    for(; itr != selectedColumns.end(); ++itr)
    {
        for(int i = 0; i < ui->lwAvailableColumns->count(); i++)
        {
            if(ui->lwAvailableColumns->item(i)->text() == *itr)
            {
                ui->lwColumnOrder->insertItem(0, ui->lwAvailableColumns->takeItem(i));
                break;
            }
        }
    }
}
Exemple #6
0
KMarkNote::KMarkNote(QWidget* parent)
    : KXmlGuiWindow(parent)
    , isPreview(false)
{
    KAction* previewAction = actionCollection()->addAction("file_preview", this, SLOT(togglePreview()));
    previewAction->setIcon(KIcon("document-preview"));
    previewAction->setText(i18n("Preview"));
    previewAction->setCheckable(true);

    m_view = new MainView(parent, previewAction);
    m_note = m_view->note;
    setupAction();
    setupUI();
    setupConnect();
}
Exemple #7
0
CustomFDialog::CustomFDialog(QWidget *parent, QString wDir, QString caption, QString filter, int flags)
			: QDialog(parent), optionFlags(flags)
{
	setModal(true);
	setWindowTitle(caption);
	setWindowIcon(QIcon(loadIcon("AppIcon.png")));
	vboxLayout = new QVBoxLayout(this);
	vboxLayout->setSpacing(5);
	vboxLayout->setMargin(10);
    hboxLayout = new QHBoxLayout;
	hboxLayout->setSpacing(5);
	hboxLayout->setMargin(0);
	fileDialog = new ScFileWidget(this);
	hboxLayout->addWidget(fileDialog);
	fileDialog->setIconProvider(new ImIconProvider());
	fileDialog->setFilter(filter);
	fileDialog->selectFilter(filter);
	fileDialog->setDirectory(wDir);
	vboxLayout1 = new QVBoxLayout;
	vboxLayout1->setSpacing(0);
	vboxLayout1->setMargin(0);
	vboxLayout1->setContentsMargins(0, 37, 0, 0);
	vboxLayout1->setAlignment( Qt::AlignTop );
	pw = new FDialogPreview( this );
	pw->setMinimumSize(QSize(200, 200));
	pw->setMaximumSize(QSize(200, 200));
	vboxLayout1->addWidget(pw);
	hboxLayout->addLayout(vboxLayout1);
	vboxLayout->addLayout(hboxLayout);
    QHBoxLayout *hboxLayout1 = new QHBoxLayout;
	hboxLayout1->setSpacing(5);
	hboxLayout1->setContentsMargins(9, 0, 0, 0);
	showPreview = new QCheckBox(this);
	showPreview->setText( tr("Show Preview"));
	showPreview->setToolTip( tr("Show a preview and information for the selected file"));
	showPreview->setChecked(true);
	previewIsShown = true;
	hboxLayout1->addWidget(showPreview);
	QSpacerItem *spacerItem = new QSpacerItem(2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum);
	hboxLayout1->addItem(spacerItem);
	OKButton = new QPushButton( CommonStrings::tr_OK, this);
	OKButton->setDefault( true );
	hboxLayout1->addWidget( OKButton );
	CancelB = new QPushButton( CommonStrings::tr_Cancel, this);
	CancelB->setAutoDefault( false );
	hboxLayout1->addWidget( CancelB );
	vboxLayout->addLayout(hboxLayout1);
	SaveZip=NULL;
	WithFonts=NULL;
	WithProfiles=NULL;
	if (flags & fdDirectoriesOnly)
	{
		Layout = new QFrame(this);
		Layout1 = new QHBoxLayout(Layout);
		Layout1->setSpacing( 0 );
		Layout1->setContentsMargins(9, 0, 0, 0);
		SaveZip = new QCheckBox( tr( "&Compress File" ), Layout);
		Layout1->addWidget(SaveZip, Qt::AlignLeft);
		QSpacerItem* spacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
		Layout1->addItem( spacer );
		vboxLayout->addWidget(Layout);
		LayoutC = new QFrame(this);
		Layout1C = new QHBoxLayout(LayoutC);
		Layout1C->setSpacing( 0 );
		Layout1C->setContentsMargins(9, 0, 0, 0);
		WithFonts = new QCheckBox( tr( "&Include Fonts" ), LayoutC);
		Layout1C->addWidget(WithFonts, Qt::AlignLeft);
		WithProfiles = new QCheckBox( tr( "&Include Color Profiles" ), LayoutC);
		Layout1C->addWidget(WithProfiles, Qt::AlignLeft);
		QSpacerItem* spacer2 = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
		Layout1C->addItem( spacer2 );
		vboxLayout->addWidget(LayoutC);
		fileDialog->setFileMode(QFileDialog::DirectoryOnly);
		pw->hide();
		showPreview->setVisible(false);
		showPreview->setChecked(false);
		previewIsShown = false;
	}
	else
	{
		if (flags & fdCompressFile)
		{
			Layout = new QFrame(this);
			Layout1 = new QHBoxLayout(Layout);
			Layout1->setSpacing( 5 );
			Layout1->setContentsMargins(9, 0, 0, 0);
			SaveZip = new QCheckBox( tr( "&Compress File" ), Layout);
			Layout1->addWidget(SaveZip);
			QSpacerItem* spacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
			Layout1->addItem( spacer );
		}
		if (flags & fdExistingFiles)
			fileDialog->setFileMode(QFileDialog::ExistingFile);
		else
		{
			fileDialog->setFileMode(QFileDialog::AnyFile);
			if (flags & fdCompressFile)
				vboxLayout->addWidget(Layout);
		}
		
		if (SaveZip!=NULL)
			SaveZip->setToolTip( "<qt>" + tr( "Compress the Scribus document on save" ) + "</qt>");
		if (WithFonts!=NULL)
			WithFonts->setToolTip( "<qt>" + tr( "Include fonts when collecting files for the document. Be sure to know and understand licensing information for any fonts you collect and possibly redistribute." ) + "</qt>");
		if (WithProfiles!=NULL)
			WithProfiles->setToolTip( "<qt>" + tr( "Include color profiles when collecting files for the document" ) + "</qt>");
		
		if (flags & fdShowCodecs)
		{
			LayoutC = new QFrame(this);
			Layout1C = new QHBoxLayout(LayoutC);
			Layout1C->setSpacing( 0 );
			Layout1C->setContentsMargins(9, 0, 0, 0);
			TxCodeT = new QLabel(this);
			TxCodeT->setText( tr("Encoding:"));
			Layout1C->addWidget(TxCodeT);
			TxCodeM = new ScComboBox(LayoutC);
			TxCodeM->setEditable(false);
			QString tmp_txc[] = {"ISO 8859-1", "ISO 8859-2", "ISO 8859-3",
								"ISO 8859-4", "ISO 8859-5", "ISO 8859-6",
								"ISO 8859-7", "ISO 8859-8", "ISO 8859-9",
								"ISO 8859-10", "ISO 8859-13", "ISO 8859-14",
								"ISO 8859-15", "UTF-8", "UTF-16", "KOI8-R", "KOI8-U",
								"CP1250", "CP1251", "CP1252", "CP1253",
								"CP1254", "CP1255", "CP1256", "CP1257",
								"Apple Roman"};
			size_t array = sizeof(tmp_txc) / sizeof(*tmp_txc);
			for (uint a = 0; a < array; ++a)
				TxCodeM->addItem(tmp_txc[a]);
			QString localEn = QTextCodec::codecForLocale()->name();
			if (localEn == "ISO-10646-UCS-2")
				localEn = "UTF-16";
			bool hasIt = false;
			for (int cc = 0; cc < TxCodeM->count(); ++cc)
			{
				if (TxCodeM->itemText(cc) == localEn)
				{
					TxCodeM->setCurrentIndex(cc);
					hasIt = true;
					break;
				}
			}
			if (!hasIt)
			{
				TxCodeM->addItem(localEn);
				TxCodeM->setCurrentIndex(TxCodeM->count()-1);
			}
			TxCodeM->setMinimumSize(QSize(200, 0));
			Layout1C->addWidget(TxCodeM);
			QSpacerItem* spacer2 = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
			Layout1C->addItem( spacer2 );
			vboxLayout->addWidget(LayoutC);
		}
		bool setter2 = flags & fdHidePreviewCheckBox;
		if (!setter2)
		{
			bool setter = flags & fdShowPreview;
			showPreview->setChecked(setter);
			previewIsShown = setter;
			pw->setVisible(setter);
		}
		else
		{
			showPreview->hide();
			previewIsShown = false;
			pw->setVisible(false);
		}
		if (flags & fdCompressFile)
			connect(SaveZip, SIGNAL(clicked()), this, SLOT(handleCompress()));
	}
#if QT_VERSION >= 0x040600
	fileDialog->setNameFilterDetailsVisible(false);
#else
	fileDialog->setOption(QFileDialog::HideNameFilterDetails);
#endif
	extZip = "gz";
	connect(OKButton, SIGNAL(clicked()), this, SLOT(accept()));
	connect(CancelB, SIGNAL(clicked()), this, SLOT(reject()));
	connect(showPreview, SIGNAL(clicked()), this, SLOT(togglePreview()));
	connect(fileDialog, SIGNAL(currentChanged(const QString &)), this, SLOT(fileClicked(const QString &)));
	connect(fileDialog, SIGNAL(filesSelected(const QStringList &)), this, SLOT(accept()));
	connect(fileDialog, SIGNAL(accepted()), this, SLOT(accept()));
	connect(fileDialog, SIGNAL(rejected()), this, SLOT(reject()));
	resize(minimumSizeHint());
}