예제 #1
0
static void scrollStyle(scrollbar s, int position)
{
    sampleStyle = Plain;
    if (!strcmp(gettext(f_style), "bold")) sampleStyle = Bold;
    if (!strcmp(gettext(f_style), "italic")) sampleStyle = Italic;    
    changeFont(s);
}
예제 #2
0
void XmdvToolMainWnd::initViewActions() {

	action_Font = new QAction(this);
	action_Font->setText(tr("Font"));
	action_Font->setObjectName(QString::fromUtf8("action_Font"));
	connect(action_Font, SIGNAL(triggered()), m_handleView, SLOT(changeFont()));
}
예제 #3
0
/*! Zmena stylu na plain*/
void MainWindow::on_actionPlain_activated()
{
    scene->readStyles("Plain");
    createConfig("Plain");
    readConfig();
    readStyle(lastUsedStyle);   //nacteni fontu pro hlavni okno
    changeFont();
}
void PluckerBookReader::processTextParagraph(char *start, char *end) {
	changeFont(FT_REGULAR);
	while (popKind()) {}

	myParagraphStarted = false;
	myBytesToSkip = 0;

	char *textStart = start;
	bool functionFlag = false;
	for (char *ptr = start; ptr < end; ++ptr) {
		if (*ptr == 0) {
			functionFlag = true;
			if (ptr > textStart) {
				safeBeginParagraph();
				myConvertedTextBuffer.erase();
				myConverter->convert(myConvertedTextBuffer, textStart, ptr);
				addData(myConvertedTextBuffer);
				myBufferIsEmpty = false;
			}
		} else if (functionFlag) {
			int paramCounter = ((unsigned char)*ptr) % 8;
			if (end - ptr > paramCounter) {
				processTextFunction(ptr);
				ptr += paramCounter;
			} else {
				ptr = end - 1;
			}
			functionFlag = false;
			if (myBytesToSkip > 0) {
				ptr += myBytesToSkip;
				myBytesToSkip = 0;
			}
			textStart = ptr + 1;
		} else {
			if ((unsigned char)*ptr == 0xA0) {
				*ptr = 0x20;
			}
			if (!myParagraphStarted && (textStart == ptr) && isspace((unsigned char)*ptr)) {
				++textStart;
			}
		}
	}
	if (end > textStart) {
		safeBeginParagraph();
		myConvertedTextBuffer.erase();
		myConverter->convert(myConvertedTextBuffer, textStart, end);
		addData(myConvertedTextBuffer);
		myBufferIsEmpty = false;
	}
	safeEndParagraph();
	if (myForcedEntry != 0) {
		delete myForcedEntry;
		myForcedEntry = 0;
	}
	myDelayedControls.clear();
}
예제 #5
0
void File::sync() 
{
   m_fileConfigurator.textDisplay->clear();
   changeFont(Preferences::FileDisplayFont());
   m_qfile.setFileName(m_file.fileName());
   if (m_qfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
      m_fileConfigurator.textDisplay->setText(QString(m_qfile.readAll()));
      m_qfile.close();
   }
}
예제 #6
0
FontPropertyToolEditor::FontPropertyToolEditor(QPushButton *bttn,
                                               QObject *parent)
    : PropertyToolEditor(bttn, parent)
{
    connect(bttn, SIGNAL(clicked()),
            this, SLOT(changeFont()));

    QFont font;
    font.setBold(true);
    font.setPointSize(10);
    setValue(QVariant::fromValue(font));
}
예제 #7
0
TextConfigurator::TextConfigurator(QWidget *parent) : QWidget(parent)
{
    QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, this);
    setLayout(layout);

    m_fontChooser = new TFontChooser;
    layout->addWidget(m_fontChooser);

    m_text = new QTextEdit(this);
    layout->addWidget(m_text);

    m_isHtml = new QCheckBox(tr("Html"));
    layout->addWidget(m_isHtml);

    layout->addStretch(1);

    connect(m_fontChooser, SIGNAL(fontChanged()), this, SLOT(changeFont()));
    changeFont();

    // new KSpellHighlighter(m_text->document());
}
예제 #8
0
void File::tail(int const interval) 
{
   m_refreshTimer.setInterval(interval);
   m_fileConfigurator.textDisplay->clear();
   changeFont(Preferences::FileDisplayFont());

   m_qfile.setFileName(m_file.fileName());
   if (m_qfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
      m_fileConfigurator.textDisplay->setText(QString(m_qfile.readAll()));
      m_refreshTimer.start();
   }
}
예제 #9
0
void TextDialog::customFont()
{
bool okF;
QFont fnt = QFontDialog::getFont( &okF, f, this);
if (okF && fnt != f)
	{
	f = fnt;
	
	fnt.setPointSize(12);
	textEditBox->setFont(fnt);

	emit changeFont (f);
	}
}
예제 #10
0
SettingsWidget::SettingsWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SettingsWidget)
{
    ui->setupUi(this);
#ifdef Q_OS_WIN
    this->ui->buttonAssociate->show();
#else
    this->ui->buttonAssociate->hide();
#endif
    this->appsColumnModel = new QStandardItemModel;
    this->backupsColumnModel = new QStandardItemModel;
    this->computerColumnModel = new QStandardItemModel;
    this->phoneColumnModel = new QStandardItemModel;

    this->setLayout(this->ui->gridLayout_7);
    this->ui->pageSettingsGeneral->setLayout(this->ui->layoutGeneralSettings);
    this->ui->pageSettingsFile->setLayout(this->ui->layoutFileSettings);
    this->ui->pageSettingsApp->setLayout(this->ui->layoutSettingsApps);
    this->ui->groupComputer->setLayout(this->ui->gridComputer);
    this->ui->groupPhone->setLayout(this->ui->gridPhone);
    ui->groupBoxBoth->setLayout(ui->gridBoth);
    ui->pageSettingsShell->setLayout(ui->shellGridLayout);
    ui->pageSettingsAnimations->setLayout(ui->layoutAnimationsSettings);
    this->currentIndex=0;

    connect(this->ui->buttonSaveSettings, SIGNAL(clicked()), this, SLOT(saveSettings()));
    connect(this->ui->buttonFontApp, SIGNAL(clicked()), this, SLOT(chooseFontApp()));
    connect(this->ui->buttonFontTables, SIGNAL(clicked()), this, SLOT(chooseFontTables()));
    connect(this->ui->buttonFontShell, SIGNAL(clicked()), this, SLOT(chooseFontShell()));
    connect(this->ui->buttonDefaults, SIGNAL(clicked()), this, SLOT(setSettingsToDefaults()));
    connect(this->ui->radioComputerPath, SIGNAL(toggled(bool)), this, SLOT(settingsSlotChanged()));
    connect(this->ui->radioPhonePath, SIGNAL(toggled(bool)), this, SLOT(settingsSlotChanged()));
    connect(this->ui->checkAppName, SIGNAL(toggled(bool)), this, SLOT(settingsSlotChanged()));
    connect(this, SIGNAL(settingsChanged()), this, SLOT(getSettings()));
    connect(this, SIGNAL(settingsChanged()), this, SLOT(changeFont()));
    connect(this->ui->listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(changePage(int)));
    connect(&this->animation.animation, SIGNAL(finished()), this, SLOT(animationFinished()));
    connect(this->ui->buttonDetectSdExt, SIGNAL(clicked()), this, SLOT(detectSdExtFolder()));

    ui->listWidgetCurvePicker->setIconSize(QSize(64,64));

    createCurveIcons();

    connect(ui->listWidgetCurvePicker, SIGNAL(currentRowChanged(int)), this, SLOT(curveChanged(int)));

    this->getSettings();
    this->changeFont();
}
예제 #11
0
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		case WM_CREATE:
			createEditor(hwnd);
			break;
		case WM_SIZE:
			resizeEditor(hwnd);
			break;
		case WM_CLOSE:
			DestroyWindow(hwnd);
			break;
		case WM_DESTROY:
			PostQuitMessage(0);
			break;
		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case ID_FILE_EXIT:
					PostMessage(hwnd, WM_CLOSE, 0, 0);
					break;
				case ID_FILE_NEW:
					SetDlgItemText(hwnd, IDC_MAIN_EDIT, "");
					break;
				case ID_FILE_OPEN:
					openFile(hwnd);
					break;
				case ID_FILE_SAVEAS:
					saveFile(hwnd);
					break;
				case ID_EDIT_FONT:
					changeFont(hwnd);
					//InvalidateRect(hEdit, NULL, TRUE);
					//UpdateWindow(hEdit);
					break;
			}
			break;
		default:
			return DefWindowProc(hwnd, msg, wParam, lParam);
	}
	return 0;
}
예제 #12
0
void FontSetupPage::fontGroupChecked(const bool checked)
{
    if (!checked) {
        changeFont(QApplication::font());
        changeFont(QApplication::font().pointSize());
        changeFont("Normal");
    } else {
        changeFont(QFont(m_familyComboBox->currentText()));
        changeFont(QString(m_styleComboBox->currentText()));
        changeFont(QString(m_sizeComboBox->currentText()).toInt());
    }

    m_customFontEnabled = checked;
}
예제 #13
0
void OFontSelector::fontFamilyClicked ( int index )
{
	QString oldstyle = d-> m_font_style_list-> currentText ( );
	QString oldsize  = d-> m_font_size_list-> currentText ( );

	FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( index );

	d-> m_font_style_list-> clear ( );
	d-> m_font_style_list-> insertStringList ( fli-> styles ( ));
	d-> m_font_style_list-> setEnabled ( !fli-> styles ( ). isEmpty ( ));

	int i;

	i = findItemCB ( d-> m_font_style_list, oldstyle );
	if ( i < 0 )
		i = findItemCB ( d-> m_font_style_list, "Regular" );
	if (( i < 0 ) && ( d-> m_font_style_list-> count ( ) > 0 ))
		i = 0;

	if ( i >= 0 ) {
		d-> m_font_style_list-> setCurrentItem ( i );
		fontStyleClicked ( i );
	}

	d-> m_font_size_list-> clear ( );
	QValueList<int> sl = fli-> sizes ( );

	for ( QValueList<int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
		d-> m_font_size_list-> insertItem ( QString::number ( *it ));

	i = findItemCB ( d-> m_font_size_list, oldsize );
	if ( i < 0 )
		i = findItemCB ( d-> m_font_size_list, "10" );
	if (( i < 0 ) && ( d-> m_font_size_list-> count ( ) > 0 ))
		i = 0;

	if ( i >= 0 ) {
		d-> m_font_size_list-> setCurrentItem ( i );
		fontSizeClicked ( i );
	}
	changeFont ( );
}
예제 #14
0
int mainForm::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: keyPress((*reinterpret_cast< uint(*)>(_a[1]))); break;
        case 1: changeFont(); break;
        case 2: changeLanguage((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: about(); break;
        case 4: readSettings(); break;
        case 5: writeSettings(); break;
        case 6: setButtonText((*reinterpret_cast< QString(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 7;
    }
    return _id;
}
예제 #15
0
// Slot called when the buffer menu item is activated
void QgsCopyrightLabelPlugin::run()
{
  QgsCopyrightLabelPluginGui *myPluginGui = new QgsCopyrightLabelPluginGui( qGisInterface->mainWindow(), QgisGui::ModalDialogFlags );
  myPluginGui->setAttribute( Qt::WA_DeleteOnClose );
  //listen for when the layer has been made so we can draw it
  //connect(myPluginGui, SIGNAL(drawRasterLayer(QString)), this, SLOT(drawRasterLayer(QString)));
  //connect(myPluginGui, SIGNAL(drawVectorLayer(QString,QString,QString)), this, SLOT(drawVectorLayer(QString,QString,QString)));
  //refresh the canvas when the user presses ok
  connect( myPluginGui, SIGNAL( changeFont( QFont ) ), this, SLOT( setFont( QFont ) ) );
  connect( myPluginGui, SIGNAL( changeLabel( QString ) ), this, SLOT( setLabel( QString ) ) );
  connect( myPluginGui, SIGNAL( changeColor( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( myPluginGui, SIGNAL( changePlacement( int ) ), this, SLOT( setPlacement( int ) ) );
  connect( myPluginGui, SIGNAL( enableCopyrightLabel( bool ) ), this, SLOT( setEnable( bool ) ) );
  myPluginGui->setText( mLabelQString );
  myPluginGui->setPlacementLabels( mPlacementLabels );
  myPluginGui->setPlacement( mPlacementIndex );
  myPluginGui->setColor( mLabelQColor );
  myPluginGui->setEnabled( mEnable );
  myPluginGui->show();
}
예제 #16
0
QgsLabelDialog::QgsLabelDialog( QgsLabel *label, QWidget *parent )
    : QWidget( parent )
    , mLabel( label )
    , mFontColor( Qt::black )
    , mBufferColor( Qt::black )
    , mFont( "Helvetica" )
{
  setupUi( this );
  QgsDebugMsg( "entering." );

  Q_ASSERT( label );

  init();

  connect( btnDefaultFont, SIGNAL( clicked() ),
           this, SLOT( changeFont() ) );
  connect( pbnDefaultBufferColor, SIGNAL( clicked() ),
           this, SLOT( changeBufferColor() ) );
  connect( pbnDefaultFontColor, SIGNAL( clicked() ),
           this, SLOT( changeFontColor() ) );
}
예제 #17
0
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: openFileSlot(); break;
        case 1: saveFileSlot(); break;
        case 2: newFileSlot(); break;
        case 3: saveAsFileSlot(); break;
        case 4: changeFont(); break;
        case 5: aboutMe(); break;
        case 6: isModified(); break;
        case 7: updateTitle(); break;
        case 8: findSlot(); break;
        default: ;
        }
        _id -= 9;
    }
    return _id;
}
예제 #18
0
void FontSetupPage::sizeChanged(const QString &text)
{
    changeFont(text.toInt());
}
예제 #19
0
void FontSetupPage::styleChanged(const QString &text)
{
    changeFont(text);
}
예제 #20
0
void FontSetupPage::familyChanged(const QFont &font)
{
    changeFont(font);
}
예제 #21
0
static void scrollFont(scrollbar s, int position)
{
    sampleFontNum = position;
    changeFont(s);
}
void PluckerBookReader::processTextFunction(char *ptr) {
	switch ((unsigned char)*ptr) {
		case 0x08:
			safeAddControl(INTERNAL_HYPERLINK, false);
			break;
		case 0x0A:
			safeAddHyperlinkControl(fromNumber(twoBytes(ptr + 1)));
			break;
		case 0x0C:
		{
			int sectionNum = twoBytes(ptr + 1);
			int paragraphNum = twoBytes(ptr + 3);
			safeAddHyperlinkControl(fromNumber(sectionNum) + '#' + fromNumber(paragraphNum));
			myReferencedParagraphs.insert(std::pair<int,int>(sectionNum, paragraphNum));
			break;
		}
		case 0x11:
			changeFont((FontType)*(ptr + 1));
			break;
		case 0x1A:
			safeBeginParagraph();
			addImageReference(fromNumber(twoBytes(ptr + 1)));
			break;
		case 0x22:
			if (!myParagraphStarted) {
				if (myForcedEntry == 0) {
					myForcedEntry = new ZLTextForcedControlEntry();
				}
				myForcedEntry->setLeftIndent(*(ptr + 1));
				myForcedEntry->setRightIndent(*(ptr + 2));
			}
			break;
		case 0x29:
			if (!myParagraphStarted) {
				if (myForcedEntry == 0) {
					myForcedEntry = new ZLTextForcedControlEntry();
				}
				switch (*(ptr + 1)) {
					case 0: myForcedEntry->setAlignmentType(ALIGN_LEFT); break;
					case 1: myForcedEntry->setAlignmentType(ALIGN_RIGHT); break;
					case 2: myForcedEntry->setAlignmentType(ALIGN_CENTER); break;
					case 3: myForcedEntry->setAlignmentType(ALIGN_JUSTIFY); break;
				}
			}
			break;
		case 0x33: // just break line instead of horizontal rule (TODO: draw horizontal rule?)
			safeEndParagraph();
			break;
		case 0x38:
			safeEndParagraph();
			break;
		case 0x40: 
			safeAddControl(EMPHASIS, true);
			break;
		case 0x48:
			safeAddControl(EMPHASIS, false);
			break;
		case 0x53: // color setting is ignored
			break;
		case 0x5C:
			addImageReference(fromNumber(twoBytes(ptr + 3)));
			break;
		case 0x60: // underlined text is ignored
			break;
		case 0x68: // underlined text is ignored
			break;
		case 0x70: // strike-through text is ignored
			break;
		case 0x78: // strike-through text is ignored
			break;
		case 0x83: 
		{
			char utf8[4];
			int len = ZLUnicodeUtil::ucs2ToUtf8(utf8, twoBytes(ptr + 2));
			safeBeginParagraph();
			addData(std::string(utf8, len));
			myBufferIsEmpty = false;
			myBytesToSkip = *(ptr + 1);
			break;
		}
		case 0x85: // TODO: process 4-byte unicode character
			break;
		case 0x8E: // custom font operations are ignored
		case 0x8C:
		case 0x8A:
		case 0x88:
			break;
		case 0x90: // TODO: add table processing
		case 0x92: // TODO: process table
		case 0x97: // TODO: process table
			break;
		default: // this should be impossible
			//std::cerr << "Oops... function #" << (int)(unsigned char)*ptr << "\n";
			break;
	}
}
예제 #23
0
void QsciEditor::setupActions() {

	cutAct = new QAction( QIcon::fromTheme( "edit-cut" ), "Cu&t", this );
	cutAct->setStatusTip( "Cut the selected text" );
	cutAct->setShortcut( tr( "Ctrl+X" ) );

	copyAct = new QAction( QIcon::fromTheme( "edit-copy" ), "&Copy", this );
	copyAct->setStatusTip( "Copy the selected text" );
	copyAct->setShortcut( tr( "Ctrl+C" ) );

	pasteAct = new QAction( QIcon::fromTheme( "edit-paste" ), "&Paste", this );
	pasteAct->setStatusTip( "Paste the text on the clipboard" );
	pasteAct->setShortcut( tr( "Ctrl+V" ) );

	deleteAct = new QAction( QIcon::fromTheme( "edit-delete" ), "&Delete", this );
	deleteAct->setStatusTip( "Delete the selected Text" );
	deleteAct->setShortcut( tr( "Delete" ) );

	selectAct = new QAction( QIcon::fromTheme( "edit-select-all" ), "Select &All", this );
	selectAct->setStatusTip( "Select all the text" );
	selectAct->setShortcut( tr( "Ctrl+A" ) );

	deselectAct = new QAction( QIcon(), "Deselect &All", this );
	deselectAct->setStatusTip( "Deselect all the text" );
	deselectAct->setShortcut( tr( "Ctrl+Shift+A" ) );

	undoAct = new QAction( QIcon::fromTheme( "edit-undo" ), "&Undo", this );
	undoAct->setStatusTip( "Undo the last change" );
	undoAct->setShortcut( tr( "Ctrl+Z" ) );

	redoAct = new QAction( QIcon::fromTheme( "edit-redo" ), "&Redo", this );
	redoAct->setStatusTip( "Redo the undone change" );
	redoAct->setShortcut( tr( "Ctrl+Y" ) );

	searchAct = new QAction( QIcon::fromTheme( "edit-find" ), "&Search", this );
	searchAct->setStatusTip( "Search the document" );
	searchAct->setShortcut( tr( "Ctrl+F" ) );

	replaceAct = new QAction( QIcon::fromTheme( "edit-find-replace" ), "&Replace", this );
	replaceAct->setStatusTip( "Replace text in the document" );
	replaceAct->setShortcut( tr( "Ctrl+R" ) );

	changeFontAct = new QAction( QIcon::fromTheme( "preferences-desktop-font" ), "Change &Font", this );
	changeFontAct->setStatusTip( "Change the font of the document" );
	changeFontAct->setShortcut( tr( "Ctrl+Shift+F" ) );

	toggleCaseAct = new QAction( "T&oggle Case of Selection", this );
	toggleCaseAct->setStatusTip( "Toggle the case of the selected text" );
	toggleCaseAct->setShortcut( tr( "Ctrl+Alt+U" ) );

	connect( this, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( showCustomMenu( const QPoint& ) ) );

	connect( cutAct, SIGNAL( triggered() ), this, SLOT( cutAction() ) );
	connect( copyAct, SIGNAL( triggered() ), this, SLOT( copyAction() ) );
	connect( pasteAct, SIGNAL( triggered() ), this, SLOT( pasteAction() ) );
	connect( deleteAct, SIGNAL( triggered() ), this, SLOT( deleteAction() ) );

	connect( undoAct, SIGNAL( triggered() ), this, SLOT( undoAction() ) );
	connect( redoAct, SIGNAL( triggered() ), this, SLOT( redoAction() ) );

	connect( selectAct, SIGNAL( triggered() ), this, SLOT( selectAction() ) );
	connect( deselectAct, SIGNAL( triggered() ), this, SLOT( deselectAction() ) );

	connect( changeFontAct, SIGNAL( triggered() ), this, SLOT( changeFont() ) );
	connect( toggleCaseAct, SIGNAL( triggered() ), this, SLOT( toggleCase() ) );

	connect( searchAct, SIGNAL( triggered() ), this, SLOT( showSearch() ) );
	connect( this, SIGNAL( linesChanged() ), this, SLOT( resizeMargins() ) );

	addAction( cutAct );
	addAction( copyAct );
	addAction( pasteAct );
	addAction( deleteAct );
	addAction( selectAct );
	addAction( deselectAct );
	addAction( undoAct );
	addAction( redoAct );
	addAction( searchAct );
	addAction( replaceAct );
	addAction( changeFontAct );
	addAction( toggleCaseAct );

	/* Change keyBindings */
	SendScintilla( SCI_ASSIGNCMDKEY, SCK_DOWN + ( SCMOD_CTRL << 16 ), SCI_PARADOWN );
	SendScintilla( SCI_ASSIGNCMDKEY, SCK_UP + ( SCMOD_CTRL << 16 ), SCI_PARAUP );
	SendScintilla( SCI_ASSIGNCMDKEY, SCK_DOWN + ( SCMOD_ALT << 16 ), SCI_LINESCROLLDOWN );
	SendScintilla( SCI_ASSIGNCMDKEY, SCK_UP + ( SCMOD_ALT << 16 ), SCI_LINESCROLLUP );

	/* Remove Ctrl+D as duplicate line */
	SendScintilla( SCI_CLEARCMDKEY, 68 + ( SCMOD_CTRL << 16 ) );
};
예제 #24
0
void Window::MakeFontBig(){
	changeFont(12, 16);
}
예제 #25
0
static void scrollPoints(scrollbar s, int position)
{
    samplePointsize = atoi(PointsList[position]);
    changeFont(s);
}
예제 #26
0
void OFontSelector::fontSizeClicked ( int /*index*/ )
{
	changeFont ( );
}
예제 #27
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    EdamProtocol *edam = EdamProtocol::GetInstance();

    ui->setupUi(this);

    pdfCache * pdf = new pdfCache(this);

    CustomNetworkAccessManager *nm = new CustomNetworkAccessManager(ui->editor->page()->networkAccessManager(), this, pdf);
    edam->setCNAM(nm);
    ui->editor->page()->setNetworkAccessManager(nm);

    Speller::setSettings(new DBSpellSettings(this, ui->editor));

    ui->editor->setContextMenuPolicy(Qt::CustomContextMenu);
    ui->editor->load(QUrl("qrc:///html/noteajax.html"));

    jsB = new jsBridge(this, pdf);
    jsB->setWebView(ui->editor);
    enmlWritter = new enml2(this);

    connect(ui->editor->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJSObject()));

    loaded = false;
    editingEnabled = false;


    tagsActions = new QActionGroup(this);
    newTag = new TagLabel(this);
    newTag->hide();
    ui->tagsBar->addWidget(newTag);

    appIcon = QIcon(":img/hippo64.png");

    trayIcon = NULL;

    bool sysTrayEnabled = sql::readSyncStatus("systemTray", true).toBool();

    if (QSystemTrayIcon::isSystemTrayAvailable() && sysTrayEnabled)
        enableSystemTrayIcon(true);

    connect(edam, SIGNAL(AuthenticateFailed()), this, SLOT(authentificationFailed()));
    connect(edam, SIGNAL(syncFinished()), this, SLOT(syncFinished()));
    connect(edam, SIGNAL(syncStarted(int)), this, SLOT(syncStarted(int)));
    connect(edam, SIGNAL(noteGuidChanged(QString,QString)), this, SLOT(changeNoteGuid(QString,QString)));
    connect(ui->notebooks, SIGNAL(itemSelectionChanged()), this, SLOT(switchNotebook()));
    connect(ui->tags, SIGNAL(itemSelectionChanged()), this, SLOT(switchTag()));
    connect(ui->tags, SIGNAL(tagAdded(QString,QString)), this, SLOT(addTag(QString,QString)));
    connect(ui->tags, SIGNAL(tagsUpdated()), this, SLOT(updateTagsToolBar()));
    connect(ui->tags, SIGNAL(tagsUpdated()), this, SLOT(switchTag()));
    connect(ui->NotesList, SIGNAL(noteSwitched()), this, SLOT(switchNote()));
    connect(ui->action_Abaut, SIGNAL(triggered()), this, SLOT(loadAboutInfo()));
    connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(closeWindow()));
    connect(ui->actionNew_Note, SIGNAL(triggered()), this, SLOT(newNote()));
    connect(ui->actionSync, SIGNAL(triggered()), this, SLOT(sync()));
    connect(ui->noteTitle, SIGNAL(textEdited(QString)), this, SLOT(noteTitleChange(QString)));
    connect(ui->actionAccount_info, SIGNAL(triggered()), this, SLOT(showUserInfo()));
    connect(ui->editor->page(), SIGNAL(linkClicked(QUrl)), this, SLOT(openURL(QUrl)));
    connect(ui->editor->page(), SIGNAL(microFocusChanged()), this, SLOT(updateEditButtonsState()));
    connect(ui->editor, SIGNAL(selectionChanged()), this, SLOT(updateSelectionButtonsState()));
    connect(ui->editor->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest)));
    connect(ui->editor, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(editorContextMenuRequested(QPoint)));
    connect(ui->editor, SIGNAL(fileInserted(QString)), this, SLOT(insertFile(QString)));
    connect(ui->notebooks, SIGNAL(noteMoved(QString,QString)), this, SLOT(moveNote(QString,QString)));
    connect(ui->notebooks, SIGNAL(noteDeleted(QString)), this, SLOT(deleteNote(QString)));
    connect(ui->notebooks, SIGNAL(noteRestored(QString,QString)), this, SLOT(restoreNote(QString,QString)));
    connect(ui->NotesList, SIGNAL(noteDeleted(QString)), this, SLOT(deleteNote(QString)));
    connect(ui->NotesList, SIGNAL(noteRestored(QString)), this, SLOT(restoreNote(QString)));
    connect(ui->NotesList, SIGNAL(noteCreated()), this, SLOT(newNote()));
    connect(ui->NotesList, SIGNAL(reloaded()), this, SLOT(updateCurrentNoteName()));
    connect(ui->editButton, SIGNAL(toggled(bool)), this, SLOT(setEditable(bool)));
    connect(ui->actionDelete_Note, SIGNAL(triggered()), this, SLOT(deleteNote()));
    connect(ui->toolBox, SIGNAL(currentChanged(int)), this, SLOT(changeTab(int)));
    connect(ui->editor->page(), SIGNAL(linkHovered(QString,QString,QString)), this, SLOT(linkHovered(QString,QString,QString)));
    connect(jsB, SIGNAL(hintMessage(QString,int)), ui->statusbar, SLOT(showMessage(QString,int)));
    connect(jsB, SIGNAL(noteChanged(QString)), this, SLOT(updateTagsToolBar(QString)));
    connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->actionDelete_Note, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->editButton, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(editingStarted(bool)), ui->editButton, SLOT(setChecked(bool)));
    connect(jsB, SIGNAL(titleUpdated(QString,QString)), this, SLOT(updateNoteTitle(QString,QString)));
    connect(jsB, SIGNAL(conflictAdded(qint64,QString,bool)), this, SLOT(addConflict(qint64,QString,bool)));
    connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionNote_Info, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionExport, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionPrint, SLOT(setEnabled(bool)));
    connect(ui->editor, SIGNAL(tagUpdated(QString,bool)), this, SLOT(updateTag(QString,bool)));
    connect(tagsActions, SIGNAL(triggered(QAction*)), this, SLOT(tagClicked(QAction*)));
    connect(newTag, SIGNAL(tagCreated(QString)), this, SLOT(createTag(QString)));
    connect(ui->actionKeep_only_this_Version, SIGNAL(triggered()), this, SLOT(keepThisVersion()));
    connect(ui->actionNote_Info, SIGNAL(triggered()), this, SLOT(showNoteInfo()));
    connect(ui->actionExport, SIGNAL(triggered()), this, SLOT(exportNote()));
    connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print()));
    connect(this, SIGNAL(titleChanged(QString,QString)), jsB, SIGNAL(titleChanged(QString,QString)));


    setWindowIcon(appIcon);
    setWindowTitle("Hippo Notes");

    setTabOrder(ui->noteTitle, ui->editor);

    ui->notebooks->setSortingEnabled(true);
    ui->notebooks->sortByColumn(0, Qt::AscendingOrder);
    ui->editBar->setVisible(false);

    ui->mainToolBar->addAction(ui->actionNew_Note);
    ui->mainToolBar->addAction(ui->actionSync);

    QFontComboBox *font = new QFontComboBox(this);
    font->setDisabled(true);
    font->setFontFilters(QFontComboBox::ScalableFonts);
    font->setEditable(false);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), font, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(updateFont(QFont)), font, SLOT(setCurrentFont(QFont)));
    connect(font, SIGNAL(activated(QString)), this, SLOT(changeFont(QString)));
    ui->editBar->addWidget(font);

    QComboBox *fontSize = new QComboBox(this);
    fontSize->setDisabled(true);
    fontSize->setEditable(false);
    for (int i = 1; i <= 7; i++)
        fontSize->addItem(QString::number(i));
    connect(this, SIGNAL(editButtonsStateChanged(bool)), fontSize, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(updateFontSize(int)), fontSize, SLOT(setCurrentIndex(int)));
    connect(fontSize, SIGNAL(activated(QString)), this, SLOT(changeFontSize(QString)));
    ui->editBar->addWidget(fontSize);

    QAction *boldIco = ui->editor->pageAction(QWebPage::ToggleBold);
    boldIco->setIcon(QIcon::fromTheme("format-text-bold"));
    ui->editBar->addAction(boldIco);

    QAction *italicIco = ui->editor->pageAction(QWebPage::ToggleItalic);
    italicIco->setIcon(QIcon::fromTheme("format-text-italic"));
    ui->editBar->addAction(italicIco);

    QAction *underlineIco = ui->editor->pageAction(QWebPage::ToggleUnderline);
    underlineIco->setIcon(QIcon::fromTheme("format-text-underline"));
    ui->editBar->addAction(underlineIco);

    QAction *strikethroughIco = ui->editor->pageAction(QWebPage::ToggleStrikethrough);
    strikethroughIco->setIcon(QIcon::fromTheme("format-text-strikethrough"));
    ui->editBar->addAction(strikethroughIco);

    ui->editBar->addSeparator();

    QAction *undoIco = ui->editor->pageAction(QWebPage::Undo);
    undoIco->setIcon(QIcon::fromTheme("edit-undo"));
    undoIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
    ui->editBar->addAction(undoIco);
    ui->menu_Edit->addAction(undoIco);

    QAction *redoIco = ui->editor->pageAction(QWebPage::Redo);
    redoIco->setIcon(QIcon::fromTheme("edit-redo"));
    redoIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z));
    ui->editBar->addAction(redoIco);
    ui->menu_Edit->addAction(redoIco);

    ui->editBar->addSeparator();

    QAction *rformatIco = ui->editor->pageAction(QWebPage::RemoveFormat);
    rformatIco->setIcon(QIcon::fromTheme("edit-clear"));
    ui->editBar->addAction(rformatIco);

    ui->editBar->addSeparator();

    QAction *leftIco = ui->editor->pageAction(QWebPage::AlignLeft);
    leftIco->setIcon(QIcon::fromTheme("format-justify-left"));
    ui->editBar->addAction(leftIco);

    QAction *centerIco = ui->editor->pageAction(QWebPage::AlignCenter);
    centerIco->setIcon(QIcon::fromTheme("format-justify-center"));
    ui->editBar->addAction(centerIco);

    QAction *rightIco = ui->editor->pageAction(QWebPage::AlignRight);
    rightIco->setIcon(QIcon::fromTheme("format-justify-right"));
    ui->editBar->addAction(rightIco);

    QAction *fillIco = ui->editor->pageAction(QWebPage::AlignJustified);
    fillIco->setIcon(QIcon::fromTheme("format-justify-fill"));
    ui->editBar->addAction(fillIco);

    ui->editBar->addSeparator();

    QAction *indentIco = ui->editor->pageAction(QWebPage::Indent);
    indentIco->setIcon(QIcon::fromTheme("format-indent-more"));
    ui->editBar->addAction(indentIco);

    QAction *outdentIco = ui->editor->pageAction(QWebPage::Outdent);
    outdentIco->setIcon(QIcon::fromTheme("format-indent-less"));
    ui->editBar->addAction(outdentIco);

    QAction *superscriptIco = ui->editor->pageAction(QWebPage::ToggleSuperscript);
    superscriptIco->setIcon(QIcon::fromTheme("format-text-superscript"));
    ui->editBar->addAction(superscriptIco);

    QAction *subscriptIco = ui->editor->pageAction(QWebPage::ToggleSubscript);
    subscriptIco->setIcon(QIcon::fromTheme("format-text-subscript"));
    ui->editBar->addAction(subscriptIco);

    QAction *unorderedIco = ui->editor->pageAction(QWebPage::InsertUnorderedList);
    unorderedIco->setIcon(QIcon::fromTheme("format-list-unordered"));
    ui->editBar->addAction(unorderedIco);

    QAction *orderedIco = ui->editor->pageAction(QWebPage::InsertOrderedList);
    orderedIco->setIcon(QIcon::fromTheme("format-list-ordered"));
    ui->editBar->addAction(orderedIco);

    QAction *lineIco = new QAction("Insert horizontal line", this);
    lineIco->setIcon(QIcon::fromTheme("insert-horizontal-rule"));
    lineIco->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), lineIco, SLOT(setEnabled(bool)));
    connect(lineIco, SIGNAL(triggered()), this, SLOT(insertHorizontalLine()));
    ui->editBar->addAction(lineIco);

    ui->menu_Edit->addSeparator();

    QAction *cutIco = ui->editor->pageAction(QWebPage::Cut);
    cutIco->setIcon(QIcon::fromTheme("edit-cut"));
    cutIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
    ui->menu_Edit->addAction(cutIco);

    QAction *copyIco = ui->editor->pageAction(QWebPage::Copy);
    copyIco->setIcon(QIcon::fromTheme("edit-copy"));
    copyIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
    ui->menu_Edit->addAction(copyIco);

    QAction *pasteIco = ui->editor->pageAction(QWebPage::Paste);
    pasteIco->setIcon(QIcon::fromTheme("edit-paste"));
    pasteIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
    ui->menu_Edit->addAction(pasteIco);

    QAction *pasteSpecialIco = ui->editor->pageAction(QWebPage::PasteAndMatchStyle);
    pasteSpecialIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V));
    ui->menu_Edit->addAction(pasteSpecialIco);

    ui->menu_Edit->addSeparator();

    QAction *insertUrlIco = new QAction("Create link", this);
    insertUrlIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
    insertUrlIco->setDisabled(true);
    insertUrlIco->setIcon(QIcon::fromTheme("insert-link"));
    connect(this, SIGNAL(selectionButtonsStateChanged(bool)), insertUrlIco, SLOT(setDisabled(bool)));
    connect(insertUrlIco, SIGNAL(triggered()), this, SLOT(insertUrl()));
    ui->menu_Edit->addAction(insertUrlIco);

    QAction *todoIco = new QAction("Insert To-do Checkbox", this);
    todoIco->setIcon(QIcon::fromTheme("checkbox"));
    todoIco->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), todoIco, SLOT(setEnabled(bool)));
    connect(todoIco, SIGNAL(triggered()), jsB, SIGNAL(insertToDo()));
    ui->menu_Edit->addAction(todoIco);

    QAction *insertImage = new QAction("Insert Image", this);
    insertImage->setIcon(QIcon::fromTheme("insert-image"));
    insertImage->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), insertImage, SLOT(setEnabled(bool)));
    connect(insertImage, SIGNAL(triggered()), this, SLOT(insertImg()));
    ui->menu_Edit->addAction(insertImage);

    QAction *insertFile = new QAction("Insert File", this);
    insertFile->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), insertFile, SLOT(setEnabled(bool)));
    connect(insertFile, SIGNAL(triggered()), this, SLOT(insertFile()));
    ui->menu_Edit->addAction(insertFile);

    QAction *encryptIco = new QAction("Encrypt Selected Text...", this);
    encryptIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_X));
    encryptIco->setDisabled(true);
    encryptIco->setIcon(QIcon::fromTheme("document-edit-encrypt"));
    connect(this, SIGNAL(selectionButtonsStateChanged(bool)), encryptIco, SLOT(setDisabled(bool)));
    connect(encryptIco, SIGNAL(triggered()), jsB, SIGNAL(encryptText()));
    ui->menu_Edit->addAction(encryptIco);

    ui->menu_Edit->addSeparator();

    QAction *options = new QAction("&Options...", this);
    options->setIcon(QIcon::fromTheme("preferences-other"));
    connect(options, SIGNAL(triggered()), this, SLOT(showOptions()));
    ui->menu_Edit->addAction(options);


    clearConflictBar();
    connect(jsB, SIGNAL(showConflict()), ui->conflictBar, SLOT(show()));
    connect(jsB, SIGNAL(showConflict()), ui->conflictBarBottom, SLOT(show()));

    conflictsGroup = new QActionGroup(this);
    connect(conflictsGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeNoteVersion(QAction*)));

    searchIndex = new SearchIndex(this);
    connect(ui->searchButton, SIGNAL(clicked()), this, SLOT(search()));
    connect(edam, SIGNAL(syncFinished()), searchIndex, SLOT(buildSearchIndex()));
    connect(jsB, SIGNAL(noteUpdated(QString)), searchIndex, SLOT(updateNoteIndex(QString)));
    connect(edam, SIGNAL(noteUpdated(QString)), searchIndex, SLOT(dropNoteIndex(QString)));
    connect(ui->searchInput, SIGNAL(returnPressed()), this, SLOT(search()));

    QByteArray mainWindowGeometry = sql::readSyncStatus("mainWindowGeometry").toString().toLatin1();
    if (!mainWindowGeometry.isEmpty())
        restoreGeometry(QByteArray::fromBase64(mainWindowGeometry));

    QByteArray mainWidgetsSplitterState = sql::readSyncStatus("mainWidgetsSplitterState").toString().toLatin1();
    if (!mainWidgetsSplitterState.isEmpty())
        ui->mainWidgetsSplitter->restoreState(QByteArray::fromBase64(mainWidgetsSplitterState));

    //showWindow();
    edam->init();
}
예제 #28
0
void MainWindow::initMenus()
{
/*Create Actions*/
    newFileAction=new QAction(tr("&New"), this);
    newFileAction->setToolTip("Create a new file");
    newFileAction->setStatusTip("wtf?");
    newFileAction->setIcon(QIcon(":/images/filenew.png"));
    newFileAction->setShortcut(QKeySequence("Ctrl+N"));
    newFileAction->showStatusText(this->statusBar());
   // newFileAction->setShortcutContext(Qt::ShortcutContext);
    openFileAction=new QAction(tr("O&pen"), this);
    openFileAction->setToolTip("Open an existing file");
    openFileAction->setIcon(QIcon(":/images/fileopen.png"));
    openFileAction->setShortcut(QKeySequence("Ctrl+O"));

    saveFileAction=new QAction(tr("&Save"), this);
    saveFileAction->setToolTip("Save current file");
    saveFileAction->setIcon(QIcon(":/images/filesave.png"));

    saveAsFileAction=new QAction(tr("Save &As"), this);
    saveAsFileAction->setIcon(QIcon(":/images/filesaveas.png"));

    exitFileAction=new QAction(tr("E&xit"),this);
    exitFileAction->setToolTip("Exit the Application");
    exitFileAction->setIcon(QIcon(":/images/fileexit.png"));

    copyEditAction=new QAction(tr("&Copy"), this);
    copyEditAction->setToolTip("Copy");
    copyEditAction->setIcon(QIcon(":/images/editcopy.png"));

    pasteEditAction=new QAction(tr("P&aste"), this);
    pasteEditAction->setToolTip("Paste");
    pasteEditAction->setIcon(QIcon(":/images/editpaste.png"));

    fontEditAction=new QAction(tr("F&ont"), this);
    fontEditAction->setToolTip("Change Font");
    fontEditAction->setIcon(QIcon(":/images/editfont.png"));

    cutEditAction=new QAction(tr("C&ut"), this);
    cutEditAction->setToolTip("Cut");
    cutEditAction->setIcon(QIcon(":/images/editcut.png"));

    findEditAction=new QAction(tr("&Find"), this);
    findEditAction->setToolTip("Find text and/or replace");
    findEditAction->setIcon(QIcon(":/images/editfind.png"));

    toolEditAction=new QAction(tr("Tool &Bar"),this);
    toolEditAction->setIcon(QIcon(":/images/edittool.png"));

    colorEditAction=new QAction(tr("Color"),this);
    colorEditAction->setIcon(QIcon(":/images/editcolor.png"));

    selectEditAction=new QAction(tr("Select All"),this);
    selectEditAction->setIcon(QIcon(":/images/editselect.png"));

    undoEditAction=new QAction(tr("Undo"),this);
    undoEditAction->setIcon(QIcon(":/images/editundo.png"));
    undoEditAction->setEnabled(false);

    redoEditAction=new QAction(tr("Redo"),this);
    redoEditAction->setIcon(QIcon(":/images/editredo.png"));
    redoEditAction->setEnabled(false);

    aboutHelpAction=new QAction(tr("&About"), this);
    aboutHelpAction->setToolTip("About this application");
    aboutHelpAction->setIcon(QIcon(":/images/helpabout.png"));
/*Connections*/
    connect(fontEditAction,SIGNAL(triggered()),this,SLOT(changeFont()));
    connect(exitFileAction,SIGNAL(triggered()),this,SLOT(close()));
    connect(aboutHelpAction,SIGNAL(triggered()),this,SLOT(aboutMe()));
    connect(findEditAction,SIGNAL(triggered()),this,SLOT(findSlot()));
    connect(copyEditAction,SIGNAL(triggered()),textArea,SLOT(copy()));
    connect(cutEditAction,SIGNAL(triggered()),textArea,SLOT(cut()));
    connect(pasteEditAction,SIGNAL(triggered()),textArea,SLOT(paste()));
    connect(selectEditAction,SIGNAL(triggered()),textArea,SLOT(selectAll()));
    connect(openFileAction,SIGNAL(triggered()),this,SLOT(openFileSlot()));
    connect(saveFileAction,SIGNAL(triggered()),this,SLOT(saveFileSlot()));
    connect(newFileAction,SIGNAL(triggered()),this,SLOT(newFileSlot()));
    connect(saveAsFileAction,SIGNAL(triggered()),this,SLOT(saveAsFileSlot()));
    connect(textArea,SIGNAL(textChanged()),this,SLOT(isModified()));
    connect(textArea,SIGNAL(undoAvailable(bool)),undoEditAction,SLOT(setEnabled(bool)));
    connect(textArea,SIGNAL(redoAvailable(bool)),redoEditAction,SLOT(setEnabled(bool)));
    connect(textArea,SIGNAL(pasteAvailable(bool)),pasteEditAction,SLOT(setEnabled(bool)));
    toolEditAction->setCheckable(true);
    toolEditAction->setChecked(true);

/*Menu Init*/
    fileMenu = menuBar()->addMenu(tr("&File"));
    //fileMenu->setStyle();
    fileMenu->addAction(newFileAction);
    fileMenu->addAction(openFileAction);
    fileMenu->addAction(saveFileAction);
    fileMenu->addAction(saveAsFileAction);
    fileMenu->addAction(exitFileAction);
    /*---*/
    editMenu = menuBar()->addMenu(tr("&Edit"));
    editMenu->addAction(cutEditAction);
    editMenu->addAction(copyEditAction);
    editMenu->addAction(pasteEditAction);
    editMenu->addAction(undoEditAction);
    editMenu->addAction(redoEditAction);
    editMenu->addAction(findEditAction);
    editMenu->addAction(selectEditAction);
    editMenu->addSeparator();
    editMenu->addAction(fontEditAction);
    editMenu->addAction(colorEditAction);
    editMenu->addAction(toolEditAction);
    /*---*/
    helpMenu = menuBar()->addMenu(tr("&Help"));
    helpMenu->addAction(aboutHelpAction);

}
예제 #29
0
void File::on_textSmallerButton_clicked(bool) {
   QFont font(Preferences::FileDisplayFont());
   int size = font.pointSize() - 1;
   font.setPointSize(size);
   changeFont(font);
}
예제 #30
0
void Window::MakeFontSmall(){
	changeFont(8, 12);
}