コード例 #1
0
ファイル: soci_container.cpp プロジェクト: skeetor/datinator
void SociContainer::handleNotification(Dispatcher<SQLPreview::ActionEvent, QVariant, int> *oSource, SQLPreview::ActionEvent nEvent, QVariant oData, int nRows)
{
	UNUSED(oSource);

	Progress prg("Fetch columns...");
	StdString query;

	if(nEvent == SQLPreview::ActionEvent::EVENT_SQL_EXECUTE)
	{
		setTablename("");
		query = oData.value<StdString>();
		mPreviewLimit = nRows;
		setQuery(query);
		refreshPreview(query, mPreviewLimit);
	}
	else if(nEvent == SQLPreview::ActionEvent::EVENT_SQL_TOGGLE)
	{
		bool enabled = oData.value<bool>();
		if(enabled)
		{
			setTablename("");
			mPreviewLimit = mPreviewPanel->getPreviewLimit();
			query = mPreviewPanel->getQuery();
			setQuery(query);
			refreshPreview(query, mPreviewLimit);
		}
	}
}
コード例 #2
0
ファイル: soci_container.cpp プロジェクト: skeetor/datinator
void SociContainer::setSelector(StdString const &oId)
{
	Progress prg("Loading from Table ...");

	if(oId.length() > 0 && oId[0] == '{') // If it is a table we select it
	{
		mTablename = oId.substr(1, oId.length()-2);
		selectTable(mTablename, false);
	}
	else
		mTablename = "";

	super::setSelector(oId);
	refreshPreview(selectorToQuery(), mPreviewLimit);
}
コード例 #3
0
LRESULT UserListColours::onChangeColour(WORD /*wNotifyCode*/, WORD /*wID*/, HWND hWndCtl, BOOL& /*bHandled*/) {
	int index = n_lsbList.GetCurSel();
	if(index == -1) return 0;
	int colour = 0;
	switch(index) {
		case 0: colour = normalColour; break;
		case 1: colour = favoriteColour; break;
		case 2: colour = reservedSlotColour; break;
		case 3: colour = ignoredColour; break;
		case 4: colour = fastColour; break;
		case 5: colour = serverColour; break;
		case 6: colour = opColour; break;
		case 7: colour = protectedColour; break; //RSX++
		case 8: colour = pasiveColour; break;
		case 9: colour = clientCheckedColour; break;
		case 10: colour = fileListCheckedColour; break;
		case 11: colour = fullCheckedColour; break;
		case 12: colour = badClientColour; break;
		case 13: colour = badFilelistColour; break;
		default: break;
	}
	CColorDialog d( colour, 0, hWndCtl );
	if (d.DoModal() == IDOK) {
		switch(index) {
			case 0: normalColour = d.GetColor(); break;
			case 1: favoriteColour = d.GetColor(); break;
			case 2: reservedSlotColour = d.GetColor(); break;
			case 3: ignoredColour = d.GetColor(); break;
			case 4: fastColour = d.GetColor(); break;
			case 5: serverColour = d.GetColor(); break;
			case 6: opColour = d.GetColor(); break;
			case 7: protectedColour = d.GetColor(); break; //RSX++
			case 8: pasiveColour = d.GetColor(); break;
			case 9: clientCheckedColour = d.GetColor(); break;
			case 10: fileListCheckedColour = d.GetColor(); break;
			case 11: fullCheckedColour = d.GetColor(); break;
			case 12: badClientColour = d.GetColor(); break;
			case 13: badFilelistColour = d.GetColor(); break;
			default: break;
		}
		refreshPreview();
	}
	return TRUE;
}
コード例 #4
0
LRESULT UserListColours::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
	PropPage::translate((HWND)(*this), texts);
	PropPage::read((HWND)*this, items);

	normalColour = SETTING(NORMAL_COLOUR);
	favoriteColour = SETTING(FAVORITE_COLOR);
	reservedSlotColour = SETTING(RESERVED_SLOT_COLOR);
	ignoredColour = SETTING(IGNORED_COLOR);
	fastColour = SETTING(FIREBALL_COLOR);
	serverColour = SETTING(SERVER_COLOR);
	pasiveColour = SETTING(PASIVE_COLOR);
	opColour = SETTING(OP_COLOR);
	protectedColour = SETTING(PROTECTED_COLOR); //RSX++
	clientCheckedColour = SETTING(CLIENT_CHECKED_COLOUR);
	fileListCheckedColour = SETTING(FILELIST_CHECKED_COLOUR);
	fullCheckedColour = SETTING(FULL_CHECKED_COLOUR);
	badClientColour = SETTING(BAD_CLIENT_COLOUR);
	badFilelistColour = SETTING(BAD_FILELIST_COLOUR);

	n_lsbList.Attach( GetDlgItem(IDC_USERLIST_COLORS) );
	n_Preview.Attach( GetDlgItem(IDC_PREVIEW) );
	n_Preview.SetBackgroundColor(WinUtil::bgColor);
	n_lsbList.AddString(CTSTRING(SETTINGS_COLOR_NORMAL));
	n_lsbList.AddString(CTSTRING(SETTINGS_COLOR_FAVORITE));	
	n_lsbList.AddString(CTSTRING(SETTINGS_COLOR_RESERVED));
	n_lsbList.AddString(CTSTRING(SETTINGS_COLOR_IGNORED));
	n_lsbList.AddString(CTSTRING(COLOR_FAST));
	n_lsbList.AddString(CTSTRING(COLOR_SERVER));
	n_lsbList.AddString(CTSTRING(COLOR_OP));
	n_lsbList.AddString(CTSTRING(PROTECTED)); //RSX++
	n_lsbList.AddString(CTSTRING(COLOR_PASIVE));
	n_lsbList.AddString(CTSTRING(SETTINGS_COLOR_CLIENT_CHECKED));
	n_lsbList.AddString(CTSTRING(SETTINGS_COLOR_FILELIST_CHECKED));
	n_lsbList.AddString(CTSTRING(SETTINGS_COLOR_FULL_CHECKED));
	n_lsbList.AddString(CTSTRING(SETTINGS_COLOR_BAD_CLIENT));
	n_lsbList.AddString(CTSTRING(SETTINGS_COLOR_BAD_FILELIST));	
	n_lsbList.SetCurSel( 0 );

	refreshPreview();

	return TRUE;
}
コード例 #5
0
SyntaxEditorWindow::SyntaxEditorWindow(SyntaxList *syntaxList, const QString &syntaxName,
		const QString &category, const QString &syntaxHint, QWidget* parent) :
		QWidget(parent), syntaxList(syntaxList), syntaxName(syntaxName)
{
	setWindowTitle(tr("Kadu syntax editor"));
	setAttribute(Qt::WA_DeleteOnClose);

	QFrame *syntax = new QFrame();

	QGridLayout *syntax_layout = new QGridLayout(syntax);
 	syntax_layout->setColumnStretch(0, 2);
 	syntax_layout->setColumnStretch(1, 1);
	syntax_layout->setSpacing(5);

	editor = new QTextEdit(syntax);
	editor->setAcceptRichText(true);
	editor->setPlainText(syntaxList->readSyntax(syntaxName));

	if (!syntaxHint.isEmpty())
		editor->setToolTip(syntaxHint);

	syntax_layout->addWidget(editor, 0, 0, 2, 1);

	previewPanel = new Preview(syntax);
	previewPanel->setResetBackgroundColor(config_file.readEntry("Look", category + "BgColor"));
	syntax_layout->addWidget(previewPanel, 0, 1);

	QPushButton *preview = new QPushButton(tr("Preview"), syntax);
	connect(preview, SIGNAL(clicked()), this, SLOT(refreshPreview()));
	syntax_layout->addWidget(preview, 1, 1);

	QWidget *buttons = new QWidget();
	QHBoxLayout *buttons_layout = new QHBoxLayout;
	buttons->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
	buttons_layout->setSpacing(5);
#ifndef Q_OS_MAC
	(new QWidget(buttons))->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
#endif
	QPushButton *saveSyntax = new QPushButton(IconsManager::instance()->loadIcon("OkWindowButton"), tr("Save"), 0);
	QPushButton *saveAsSyntax = new QPushButton(IconsManager::instance()->loadIcon("OkWindowButton"), tr("Save as..."), 0);
	QPushButton *cancel = new QPushButton(IconsManager::instance()->loadIcon("CloseWindowButton"), tr("Cancel"), 0);

	buttons_layout->addWidget(saveSyntax);
	buttons_layout->addWidget(saveAsSyntax);
	buttons_layout->addWidget(cancel);
	buttons->setLayout(buttons_layout);

	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->addWidget(syntax);
	layout->addWidget(buttons);

	if (syntaxList->isGlobal(syntaxName))
		saveSyntax->setDisabled(true);
	else
		connect(saveSyntax, SIGNAL(clicked()), this, SLOT(save()));

	connect(saveAsSyntax, SIGNAL(clicked()), this, SLOT(saveAs()));
	connect(cancel, SIGNAL(clicked()), this, SLOT(close()));

	loadWindowGeometry(this, "Look", "SyntaxEditorGeometry", 0, 50, 790, 480);
}
コード例 #6
0
SyntaxEditorWindow::SyntaxEditorWindow(const QSharedPointer<SyntaxList> &syntaxList, const QString &syntaxName,
		const QString &category, const QString &syntaxHint, QWidget *parent) :
		QWidget(parent), syntaxList(syntaxList), syntaxName(syntaxName)
{
	setWindowRole("kadu-syntax-editor");

	setWindowTitle(tr("Kadu syntax editor"));
	setAttribute(Qt::WA_DeleteOnClose);

	QVBoxLayout *layout = new QVBoxLayout(this);

	QSplitter *splitter = new QSplitter(this);
	layout->addWidget(splitter);
	splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	splitter->setChildrenCollapsible(false);

	QWidget *splitterleft = new QWidget(splitter);
	QVBoxLayout *splitterleftlayout = new QVBoxLayout(splitterleft);
	splitterleftlayout->setMargin(0);
	splitterleftlayout->setSpacing(5);

	editor = new QTextEdit(this);
	splitterleftlayout->addWidget(editor);
	editor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	editor->setAcceptRichText(true);
	editor->setPlainText(syntaxList->readSyntax(syntaxName));
	QFont font = this->font();
	font.setFamily("monospace");
	if(font.pixelSize() == -1)
		font.setPointSizeF(font.pointSizeF() - 0.5);
	else
		font.setPixelSize(font.pixelSize() - 2);
	editor->setFont(font);
	editor->setMinimumSize(EDITOR_MINIMUM_SIZE);

	if (!syntaxHint.isEmpty())
	{
		QLabel *editorhint = new QLabel(this);
		splitterleftlayout->addWidget(editorhint);
		editorhint->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
		editorhint->setWordWrap(true);
		editorhint->setText(syntaxHint);
	}

	QWidget *splitterright = new QWidget(splitter);
	QVBoxLayout *splitterrightlayout = new QVBoxLayout(splitterright);
	splitterrightlayout->setMargin(0);
	splitterrightlayout->setSpacing(5);

	previewPanel = new Preview(this);
	splitterrightlayout->addWidget(previewPanel);
	previewPanel->setMinimumHeight(0);
	previewPanel->setMaximumHeight(QWIDGETSIZE_MAX);
	previewPanel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
	previewPanel->setResetBackgroundColor(config_file.readEntry("Look", category + "BgColor"));
	previewPanel->setMinimumSize(PREVIEW_MINIMUM_SIZE);

	QPushButton *previewbutton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_BrowserReload), tr("Refresh Preview"), this);
	splitterrightlayout->addWidget(previewbutton);
	connect(previewbutton, SIGNAL(clicked()), this, SLOT(refreshPreview()));

	QDialogButtonBox *buttonslayout = new QDialogButtonBox(Qt::Horizontal, this);
	layout->addWidget(buttonslayout);
	QPushButton *saveSyntax = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogOkButton), tr("Save"), this);
	QPushButton *saveAsSyntax = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogSaveButton), tr("Save as..."), this);
	QPushButton *cancel = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this);
	buttonslayout->addButton(saveSyntax, QDialogButtonBox::YesRole);
	buttonslayout->addButton(saveAsSyntax, QDialogButtonBox::ActionRole);
	buttonslayout->addButton(cancel, QDialogButtonBox::RejectRole);

	splitter->setSizes( QList<int>() << splitter->sizeHint().width() << 1 );

	if (syntaxList->isGlobal(syntaxName))
		saveSyntax->setDisabled(true);
	else
		connect(saveSyntax, SIGNAL(clicked()), this, SLOT(save()));
	connect(saveAsSyntax, SIGNAL(clicked()), this, SLOT(saveAs()));
	connect(cancel, SIGNAL(clicked()), this, SLOT(close()));

	loadWindowGeometry(this, "Look", "SyntaxEditorGeometry", 0, 50, 790, 480);
}
コード例 #7
0
ファイル: keybindings.cpp プロジェクト: TonyAlloa/miranda-dev
static LRESULT CALLBACK KeyBindingsEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
		case WM_CREATE:
			virtualKey = 0;
			break;
		case WM_SYSKEYDOWN:
		case WM_KEYDOWN:
			if (virtualKey != 0) {
				virtualKey = 0;
			}
		    switch (wParam)
			{
				case VK_SHIFT:
					tempModifiers |= KB_SHIFT_FLAG;
					break;
				case VK_CONTROL:
					tempModifiers |= KB_CTRL_FLAG;
					break;
				case VK_MENU:
					tempModifiers |= KB_ALT_FLAG;
					break;
				default:
					virtualKey = wParam;
					break;
			}
			modifiers = tempModifiers;
			refreshPreview(hwnd);
			return 0;
		case WM_KEYUP:
		case WM_SYSKEYUP:
			switch (wParam)
			{
				case VK_SHIFT:
					tempModifiers &= ~KB_SHIFT_FLAG;
					break;
				case VK_CONTROL:
					tempModifiers &= ~KB_CTRL_FLAG;
					break;
				case VK_MENU:
					tempModifiers &= ~KB_ALT_FLAG;
					break;
				default:
					break;
			}
			if (virtualKey == 0) {
				modifiers = tempModifiers;
				refreshPreview(hwnd);
			}
		case WM_CHAR:
		case WM_PASTE:
			return 0;
		case WM_SETFOCUS:
			modifiers = 0;
			tempModifiers = 0;
			virtualKey = 0;
			refreshPreview(hwnd);
			break;
		case WM_GETDLGCODE:
			return DLGC_WANTARROWS|DLGC_WANTALLKEYS| DLGC_WANTTAB;
	}
	return CallWindowProc(OldEditProc, hwnd, msg, wParam, lParam);
}