コード例 #1
0
ファイル: modules.cpp プロジェクト: MrtsComputers/miranda-ng
INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	if (msg == WM_INITDIALOG) {
		SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
		TranslateDialogDefault(hwnd);
	}

	if (msg == WM_COMMAND) {
		switch (LOWORD(wParam)) {
		case IDOK:
			if (GetWindowTextLength(GetDlgItem(hwnd, IDC_MODNAME))) {
				char modulename[256];
				GetDlgItemText(hwnd, IDC_MODNAME, modulename, 256);
				if (IsDlgButtonChecked(hwnd, CHK_ADD2ALL)) {
					// null contact
					db_set_b(NULL, modulename, "(Default)", 0);
					for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
						db_set_b(hContact, modulename, "(Default)", 0);
				}
				else db_set_b((HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA), modulename, "(Default)", 0);

				refreshTree(1);
			}
			// fall through
		case IDCANCEL:
			DestroyWindow(hwnd);
			break;
		}
	}
	return 0;
}
コード例 #2
0
ファイル: mainwindow.cpp プロジェクト: enkidu/battalbol
void MainWindow::addAuth()
{
    if(!ui->le_pass->text().isEmpty() && !ui->le_user->text().isEmpty())
        if(!auths.contains(ui->le_user->text()))
        {
            auths.insert(ui->le_user->text(), ui->le_pass->text());
            refreshTree();
        }
}
コード例 #3
0
ファイル: mainwindow.cpp プロジェクト: enkidu/battalbol
void MainWindow::delAuth()
{
    QTreeWidgetItem * item = ui->tw_auths->currentItem();
    if(item)
        if(auths.contains(item->text(0)))
        {
            auths.remove(item->text(0));
            refreshTree();
        }
}
コード例 #4
0
RemoteDeckList_TreeModel::RemoteDeckList_TreeModel(AbstractClient *_client, QObject *parent)
    : QAbstractItemModel(parent), client(_client)
{
    QFileIconProvider fip;
    dirIcon = fip.icon(QFileIconProvider::Folder);
    fileIcon = fip.icon(QFileIconProvider::File);

    root = new DirectoryNode;
    refreshTree();
}
コード例 #5
0
RemoteReplayList_TreeModel::RemoteReplayList_TreeModel(AbstractClient *_client, QObject *parent)
    : QAbstractItemModel(parent), client(_client)
{
    QFileIconProvider fip;
    dirIcon = fip.icon(QFileIconProvider::Folder);
    fileIcon = fip.icon(QFileIconProvider::File);
    lockIcon = QIcon(":/resources/lock.svg");

    refreshTree();
}
コード例 #6
0
void TabManagerWidget::delayedRefreshTree(WebPage* p)
{
    if (m_refreshBlocked || m_waitForRefresh) {
        return;
    }

    if (m_isRefreshing && !p) {
        return;
    }

    m_webPage = p;
    m_waitForRefresh = true;
    QTimer::singleShot(50, this, SLOT(refreshTree()));
}
コード例 #7
0
ファイル: CommentsWidget.cpp プロジェクト: joydit/cutter
CommentsWidget::CommentsWidget(MainWindow *main, QAction *action) :
    CutterDockWidget(main, action),
    ui(new Ui::CommentsWidget),
    main(main)
{
    ui->setupUi(this);

    commentsModel = new CommentsModel(&comments, &nestedComments, this);
    commentsProxyModel = new CommentsProxyModel(commentsModel, this);
    ui->commentsTreeView->setModel(commentsProxyModel);
    ui->commentsTreeView->sortByColumn(CommentsModel::CommentColumn, Qt::AscendingOrder);

    // Ctrl-F to show/hide the filter entry
    QShortcut *searchShortcut = new QShortcut(QKeySequence::Find, this);
    connect(searchShortcut, &QShortcut::activated, ui->quickFilterView, &QuickFilterView::showFilter);
    searchShortcut->setContext(Qt::WidgetWithChildrenShortcut);

    // Esc to clear the filter entry
    QShortcut *clearShortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this);
    connect(clearShortcut, &QShortcut::activated, ui->quickFilterView, &QuickFilterView::clearFilter);
    clearShortcut->setContext(Qt::WidgetWithChildrenShortcut);

    connect(ui->quickFilterView, SIGNAL(filterTextChanged(const QString &)),
            commentsProxyModel, SLOT(setFilterWildcard(const QString &)));
    connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->commentsTreeView, SLOT(setFocus()));

    setScrollMode();

    ui->actionHorizontal->setChecked(true);
    this->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)),
            this, SLOT(showTitleContextMenu(const QPoint &)));

    connect(Core(), SIGNAL(commentsChanged()), this, SLOT(refreshTree()));
    connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshTree()));
}
コード例 #8
0
ファイル: deletemodule.cpp プロジェクト: slotwin/miranda-ng
INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg) {
	case WM_INITDIALOG:
		SetWindowText(hwnd,Translate("Delete module from Database... Loading"));
		EnableWindow(GetDlgItem(hwnd,IDC_CONTACTS),0);
		EnableWindow(GetDlgItem(hwnd,IDOK),0);
		SetDlgItemText(hwnd,IDC_INFOTEXT, Translate("Delete module from Database"));
		SetDlgItemText(hwnd,CHK_COPY2ALL, Translate("Delete module from all contacts (Includes Setting)"));
		EnableWindow(GetDlgItem(hwnd,CHK_COPY2ALL),0);
		CheckDlgButton(hwnd,CHK_COPY2ALL,1);
		TranslateDialogDefault(hwnd);
		working = 1;
		forkthread(PopulateModuleDropListThreadFunc,0,hwnd);
		return TRUE;

	case WM_COMMAND:
		switch(LOWORD(wParam)) {
		case IDOK:
			{
				char text[128];
				GetDlgItemText(hwnd,IDC_CONTACTS,text,128);
				SetCursor(LoadCursor(NULL,IDC_WAIT));
				for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
					deleteModule(text,hContact,1);

				// do the null
				deleteModule(text,NULL,1);
				SetCursor(LoadCursor(NULL,IDC_ARROW));
				refreshTree(1);
			}
			// fall through
		case IDCANCEL:
			if (working == 1) {
				working = 0;
				EnableWindow(GetDlgItem(hwnd,IDCANCEL),0);
			}
			else DestroyWindow(hwnd);
		}
		break;

	case WM_DESTROY:
		hwnd2Delete = NULL;
		break;
	}
	return 0;
}
コード例 #9
0
ファイル: main.cpp プロジェクト: Seldom/miranda-ng
INT_PTR DBEditorppMenuCommand(WPARAM wParam, LPARAM)
{
	if (!hwnd2mainWindow) { // so only opens 1 at a time
		hRestore = wParam;
		openMainWindow();
	}
	else {
		ShowWindow(hwnd2mainWindow, SW_RESTORE);
		SetForegroundWindow(hwnd2mainWindow);
		if (!hRestore && wParam) {
			hRestore = wParam;
			refreshTree(4);
		}
	}

	if (hTTBButt)
		CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (LPARAM)0);

	return 0;
}
コード例 #10
0
ファイル: main.cpp プロジェクト: MrtsComputers/miranda-ng
INT_PTR DBEditorppMenuCommand(WPARAM wParam, LPARAM lParam)
{
	if (!hwnd2mainWindow) { // so only opens 1 at a time
	    hRestore = (HANDLE)wParam;
		SetCursor(LoadCursor(NULL,IDC_WAIT));
		CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), 0, MainDlgProc);
	}
	else {
		ShowWindow(hwnd2mainWindow, SW_RESTORE);
		SetForegroundWindow(hwnd2mainWindow);
		if (!hRestore && wParam) {
			hRestore = (HANDLE)wParam;
			refreshTree(4);
		}
	}

	if (hTTBButt)
		CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (LPARAM)(TTBST_RELEASED));

	return 0;
}
コード例 #11
0
ファイル: renamemodule.cpp プロジェクト: tweimer/miranda-ng
static INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg) {
	case WM_INITDIALOG:
		SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
		TranslateDialogDefault(hwnd);

		wchar_t msg[MSG_SIZE], name[NAME_SIZE];
		GetContactName((MCONTACT)lParam, nullptr, name, _countof(name));

		mir_snwprintf(msg, TranslateT("Add module to \"%s\""), name);
		SetWindowText(hwnd, msg);
		break;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDOK:
			if (GetWindowTextLength(GetDlgItem(hwnd, IDC_MODNAME))) {
				char modulename[FLD_SIZE];
				GetDlgItemTextA(hwnd, IDC_MODNAME, modulename, _countof(modulename));
				if (IsDlgButtonChecked(hwnd, CHK_ADD2ALL)) {
					// null contact
					db_set_b(NULL, modulename, "(Default)", 0);
					for (auto &hContact : Contacts())
						db_set_b(hContact, modulename, "(Default)", 0);
				}
				else db_set_b((MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), modulename, "(Default)", 0);

				refreshTree(1);
			}
			__fallthrough;

		case IDCANCEL:
			DestroyWindow(hwnd);
			break;
		}
	}
	return 0;
}
コード例 #12
0
void KWDocStructTree::setup()
{
    setRootIsDecorated( true );
    setSorting( -1 );
    refreshTree((int)(TextFrames | FormulaFrames | Tables | Pictures | Embedded));
}
コード例 #13
0
ファイル: copymodule.cpp プロジェクト: 0xmono/miranda-ng
INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	ModuleAndContact *mac = (ModuleAndContact *)GetWindowLongPtr(hwnd,GWLP_USERDATA);
	if (msg == WM_INITDIALOG)
	{
		int index, loaded;
		char szProto[256];
		for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
			if (GetValue(hContact,"Protocol","p",szProto,SIZEOF(szProto)))
				loaded = IsProtocolLoaded(szProto);
			else
				loaded = 0;

			// filter
			if ((loaded && Mode == MODE_UNLOADED) || (!loaded && Mode == MODE_LOADED))
				continue;

			// contacts name
			DBVARIANT dbv ={0};
			WCHAR nick[256];
			WCHAR protoW[256]; // unicode proto

			if (szProto[0])
				a2u(szProto, protoW, SIZEOF(protoW));
			else
				protoW[0] = 0;

			if (!szProto[0] || !loaded) {
				if (protoW) {
					if (Order)
						mir_snwprintf(nick, SIZEOF(nick), L"(%s) %s %s", protoW, GetContactName(hContact, szProto, 1), L"(UNLOADED)");
					else
						mir_snwprintf(nick, SIZEOF(nick), L"%s (%s) %s", GetContactName(hContact, szProto, 1), protoW, L"(UNLOADED)");
				}
				else wcscpy(nick, nick_unknownW);
			}
			else {
				if (Order)
					mir_snwprintf(nick, SIZEOF(nick), L"(%s) %s", protoW, GetContactName(hContact, szProto, 1));
				else
					mir_snwprintf(nick, SIZEOF(nick), L"%s (%s)", GetContactName(hContact, szProto, 1), protoW);
			}

			index = SendMessageW(GetDlgItem(hwnd, IDC_CONTACTS), CB_ADDSTRING, 0, (LPARAM)nick);
			SendMessageW(GetDlgItem(hwnd, IDC_CONTACTS), CB_SETITEMDATA, index, hContact);
		}

		index = (int)SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_INSERTSTRING, 0, (LPARAM)(char*)Translate("Settings"));
		SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_SETITEMDATA, index, 0);
		SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_SETCURSEL, index, 0);

		SetWindowLongPtr(hwnd,GWLP_USERDATA,lParam);
		TranslateDialogDefault(hwnd);
	}
	else if (msg == WM_COMMAND)
	{
		switch(LOWORD(wParam)) {
		case CHK_COPY2ALL:
			EnableWindow(GetDlgItem(hwnd, IDC_CONTACTS),!IsDlgButtonChecked(hwnd,CHK_COPY2ALL));
			break;

		case IDOK:
			if (!IsDlgButtonChecked(hwnd,CHK_COPY2ALL)) {
				MCONTACT hContact = (MCONTACT)SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETITEMDATA, SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETCURSEL, 0, 0), 0);
				copyModule(mac->module, mac->hContact, hContact);
			}
			else {
				SetCursor(LoadCursor(NULL,IDC_WAIT));
				for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
					copyModule(mac->module, mac->hContact, hContact);

				SetCursor(LoadCursor(NULL,IDC_ARROW));
			}
			mir_free(mac);
			refreshTree(1);
			DestroyWindow(hwnd);
			break;

		case IDCANCEL:
			mir_free(mac);
			DestroyWindow(hwnd);
			break;
		}
	}
	return 0;
}
コード例 #14
0
ファイル: moduletree.cpp プロジェクト: 0xmono/miranda-ng
void moduleListRightClick(HWND hwnd, WPARAM wParam, LPARAM lParam) // hwnd here is to the main window, NOT the treview
{
	TVHITTESTINFO hti;
	hti.pt.x = (short)LOWORD(GetMessagePos());
	hti.pt.y = (short)HIWORD(GetMessagePos());
	ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);

	if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
		if (hti.flags & TVHT_ONITEM) {
			TVITEM tvi = {0};
			HMENU hMenu, hSubMenu;
			int menuNumber;
			char module[256];
			tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
			tvi.hItem = hti.hItem;
			tvi.pszText = module;
			tvi.cchTextMax = 255;
			TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
			if (tvi.lParam) {
				ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
				MCONTACT hContact = mtis->hContact;
				GetCursorPos(&hti.pt);
				hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXTMENU));
				TranslateMenu(hMenu);
				if (mtis->type == CONTACT && hContact)
					menuNumber = 2;
				else if ((mtis->type == MODULE) && !hContact)
					menuNumber = 1;
				else if (mtis->type == CONTACT && !hContact)
					menuNumber = 3;
				else if (mtis->type == CONTACT_ROOT_ITEM && !hContact)
					menuNumber = 4;
				else if ((mtis->type == MODULE) && hContact)
					menuNumber = 5;
				else return;
				hSubMenu = GetSubMenu(hMenu, menuNumber);

				TranslateMenu(hSubMenu);
				switch (menuNumber) {
				case 1: // null module
				case 5: // contact module
					{
						// check if we r already watching the module
						int i, watching = 0;
						// check if the setting is being watched and if it is then check the menu item
						if (WatchListArray.item)
							for (i = 0; i < WatchListArray.count; i++)
								if (WatchListArray.item[i].module && (hContact == WatchListArray.item[i].hContact)) {
									if (!mir_strcmp(module, WatchListArray.item[i].module) && !WatchListArray.item[i].setting) {
										// yes so uncheck it
										CheckMenuItem(hSubMenu, MENU_WATCH_ITEM, MF_CHECKED | MF_BYCOMMAND);
										watching = 1;
										break;
									}
								}

						switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
						case MENU_RENAME_MOD:
							TreeView_EditLabel(GetDlgItem(hwnd, IDC_MODULES), tvi.hItem);
							break;

						case MENU_DELETE_MOD:
							if (deleteModule(module, hContact, 0)) {
								TreeView_DeleteItem(((LPNMHDR)lParam)->hwndFrom, hti.hItem);
								mir_free(mtis);
							}
							break;

						case MENU_COPY_MOD:
							copyModuleMenuItem(module, hContact);
							break;

							////////////////////////////////////////////////////////////////////// divider
						case MENU_WATCH_ITEM:
							if (!watching)
								addSettingToWatchList(hContact, module, 0);
							else
								freeWatchListItem(i);
							if (hwnd2watchedVarsWindow)
								PopulateWatchedWindow(GetDlgItem(hwnd2watchedVarsWindow, IDC_VARS));
							break;

						case MENU_EXPORTMODULE:
							exportDB(hContact, module);
							break;

						case MENU_EXPORTDB:
							exportDB(INVALID_CONTACT_ID, module);
							break;
						}
					}
					break;

				case 2: // contact
					switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
					case MENU_CLONE_CONTACT:
						if (CloneContact(hContact))
							refreshTree(1);
						break;

					case MENU_DELETE_CONTACT:
						if (db_get_b(NULL, "CList", "ConfirmDelete", 1)) {
							char msg[1024];
							mir_snprintf(msg, SIZEOF(msg), Translate("Are you sure you want to delete contact \"%s\"?"), module);
							if (MessageBox(0, msg, Translate("Confirm contact delete"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES) {
								CallService(MS_DB_CONTACT_DELETE, hContact, 0);
								freeTree(((LPNMHDR)lParam)->hwndFrom, hContact);
								TreeView_DeleteItem(((LPNMHDR)lParam)->hwndFrom, tvi.hItem);
							}
						}
						else {
							CallService(MS_DB_CONTACT_DELETE, hContact, 0);
							freeTree(((LPNMHDR)lParam)->hwndFrom, hContact);
							TreeView_DeleteItem(((LPNMHDR)lParam)->hwndFrom, tvi.hItem);
						}
						break;

					////////////////////////////////////////////////////////////////////// divider
					case MENU_EXPORTCONTACT:
						exportDB(hContact, 0);
						break;
					case MENU_IMPORTFROMTEXT:
						ImportSettingsMenuItem(hContact);
						break;
					case MENU_IMPORTFROMFILE:
						ImportSettingsFromFileMenuItem(hContact, "");
						break;

					////////////////////////////////////////////////////////////////////// divider
					case MENU_ADD_MODULE:
						{
							HWND AddModhwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADD_MODULE), hwnd, AddModDlgProc, hContact);
							char msg[1024];
							mir_snprintf(msg, SIZEOF(msg), Translate("Add module to contact \"%s\""), module);
							SetWindowText(AddModhwnd, module);
						}
						break;
					}
					break;

				case 3: // NULL contact
					switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
					case MENU_ADD_MODULE:
						{
							HWND AddModhwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADD_MODULE), hwnd, AddModDlgProc, hContact);
							char msg[1024];
							mir_snprintf(msg, SIZEOF(msg), Translate("Add module to contact \"%s\""), module);
							SetWindowText(AddModhwnd, module);
						}
						break;
					case MENU_EXPORTCONTACT:
						exportDB(NULL, 0);
						break;
					case MENU_IMPORTFROMTEXT:
						ImportSettingsMenuItem(NULL);
						break;
					case MENU_IMPORTFROMFILE:
						ImportSettingsFromFileMenuItem(NULL, "");
						break;
					}
					break;

				case 4: // Contacts root
					switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
					case MENU_EXPORTCONTACT:
						exportDB(INVALID_CONTACT_ID, "");
						break;
					case MENU_IMPORTFROMTEXT:
						ImportSettingsMenuItem(NULL);
						break;
					case MENU_IMPORTFROMFILE:
						ImportSettingsFromFileMenuItem(NULL, "");
						break;
					}
					break;
				}
				DestroyMenu(hMenu);
			}
		}
	}
}
コード例 #15
0
ファイル: mainwindow.cpp プロジェクト: enkidu/battalbol
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    for (int i = 0; i < 6 ;i++)
    {
        levels.append(0);
    }
    ui->setupUi(this);
    settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, "enkidu", "battalbot");
    ui->le_server->setText(settings->value("server", "").toString());
    ui->le_channel->setText(settings->value("channel", "").toString());
    ui->le_botname->setText(settings->value("botname", "").toString());
    QHash<QString, QVariant> tmp;
    auths = settings->value("auths", tmp).toHash();
    onFinish = false;
    added = 0;
    QLocale::setDefault(QLocale::English);
    trayIcon = new QSystemTrayIcon();
    QMenu *menu = new QMenu();
    QAction *actionQuit = new QAction("Quit", trayIcon);
    menu->addAction(actionQuit);
    trayIcon->setContextMenu(menu);
    trayIcon->setIcon(QIcon(":/icon.png"));
    trayIcon->show();
    this->setWindowIcon(QIcon(":/icon.png"));
    this->setWindowTitle("eRepublik wall-watching BOT");
    connect(ui->pb_connect, SIGNAL(clicked()), this, SLOT(connectToServer()));
    irc = new Irc(this);
    reader = new Reader;
    battle = new Battle;
    refreshTree();
    connect(battle, SIGNAL(getWall()), reader, SLOT(read()));
    connect(ui->pb_StartCount, SIGNAL(clicked()), this, SLOT(getInfo()));
    connect(reader, SIGNAL(startCounting(int,QTime)), battle, SLOT(startCounting(int, QTime)));
    connect(reader, SIGNAL(startCounting(int,QTime)), this, SLOT(setInitialWall(int,QTime)));
    connect(battle, SIGNAL(setTimeT(QTime)), this, SLOT(setTimeElapsed(QTime)));
    connect(reader, SIGNAL(wall(int,bool)), battle, SLOT(actWall(int,bool)));
    connect(reader, SIGNAL(wall(int,bool)), this, SLOT(setWall(int,bool)));
    connect(battle, SIGNAL(setText(QString)), irc, SLOT(write(QString)));
    connect(reader, SIGNAL(battleInfo(QString)), irc, SLOT(setTopic(QString)));

    connect(trayIcon,
            SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this,
            SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));

    connect(irc, SIGNAL(authRequest(QString,QString,QString)),
            this, SLOT(auth(QString,QString,QString)));

    connect(irc, SIGNAL(wallRequest(QString,QString)),
            this, SLOT(wall(QString,QString)));

    connect(irc, SIGNAL(playerRequest(QString)),
            reader, SLOT(getPlayer(QString)));

    connect(reader, SIGNAL(playerInfo(QString)),
            irc, SLOT(write(QString)));

    connect(ui->pb_authAdd, SIGNAL(clicked()),
            this, SLOT(addAuth()));

    connect(ui->pb_delAuth, SIGNAL(clicked()),
            this, SLOT(delAuth()));

    connect(actionQuit, SIGNAL(triggered()), this, SLOT(appQuit()));
    curve = new QwtPlotCurve();
    curve->setRenderHint(QwtPlotItem::RenderAntialiased);
    curve->attach(ui->qwtPlot);
    for (int i = 0; i < 6; i++)
    {
        QwtPlotCurve *line = new QwtPlotCurve();
        if (i == 0 || i == 5)
        {
            line->setPen(QPen(QColor(0,0,255)));
        }
        else
        {
            line->setPen(QPen(QColor(0,200,0)));
        }
        line->attach(ui->qwtPlot);
        lines.append(line);
    }
}
コード例 #16
0
INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		case WM_INITDIALOG:
		{
			hwnd2importWindow = hwnd;
			SetWindowLongPtr(hwnd,GWLP_USERDATA,lParam);
			TranslateDialogDefault(hwnd);
			SendDlgItemMessage(hwnd, IDC_TEXT, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR)*0x7FFFFFFF, 0);
		}
		break;

		case WM_COMMAND:
		{
			switch(LOWORD(wParam))
			{
				case IDC_CRLF:
				{
					int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_TEXT));
					char *string = (char*)_malloca(length+3);
					int Pos = 2;

    				if (length)
					{
						int	Range = SendDlgItemMessage(hwnd,IDC_TEXT,EM_GETSEL,0,0);
						int Min = LOWORD(Range);
						int Max = HIWORD(Range);


						GetDlgItemText(hwnd, IDC_TEXT, string, length+1);

						if (Min == -1)
							memcpy(string, crlf_string, SIZEOF(crlf_string));
						else
						if (Max == -1 || Max >= length)
							memcpy(&string[Min], crlf_string, SIZEOF(crlf_string));
						else
						if (Max-Min > 2)
						{
							memcpy(&string[Min], crlf_string, SIZEOF(crlf_string));
							memmove(&string[Min+2], &string[Max], length - Max + 1);
						}
						else
						{
							memmove(&string[Min+2], &string[Max], length - Max + 1);
							memcpy(&string[Min], crlf_string, SIZEOF(crlf_string));
						}

						if (Min) Pos += Min;
					}
					else
						memcpy(string, crlf_string, SIZEOF(crlf_string));

					SetDlgItemText(hwnd, IDC_TEXT, string);
					SendDlgItemMessage(hwnd,IDC_TEXT,EM_SETSEL,Pos,Pos);
					SetFocus(GetDlgItem(hwnd, IDC_TEXT));
				}
				break;
				
				case IDOK:
				{
					HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd,GWLP_USERDATA);
					int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_TEXT));
					char *string;
					if (length)
					{
						string = (char*)_malloca(length+1);
						if (!string) {msg(Translate("Couldnt allocate enough memory!"), modFullname); DestroyWindow(hwnd); }
						GetDlgItemText(hwnd, IDC_TEXT, string, length+1);
						importSettings(hContact, string);
						refreshTree(1);
					}
				}
				break;
				
				case IDCANCEL:
					DestroyWindow(hwnd);
					hwnd2importWindow = 0;
				break;
			}
		}
		break;
	}
	return 0;
}
コード例 #17
0
void ImportSettingsFromFileMenuItem(HANDLE hContact, char* FilePath)
{
	char szFileNames[MAX_PATH*10] = {0};
	char szPath[MAX_PATH] = "";
	char szFile[MAX_PATH];
	int index = 0;
	HANDLE hFile, hMap;
	PBYTE pFile = NULL;
	DWORD offset = 0;
	if (lstrcmp(FilePath, "") == 0)
		offset = Openfile2Import(szFileNames);
	else
	{
		if(Exists(FilePath))
			lstrcpy(szFileNames, FilePath);
		else
			lstrcpy(szFileNames, "");
	}

	if (!lstrcmp(szFileNames, "") == 0)
	{
		if ((DWORD)lstrlenA(szFileNames) < offset)
		{
			index += offset;
			strncpy(szPath, szFileNames, offset);
			strcat(szPath, "\\");
		}

		while(szFileNames[index])
		{
			strcpy(szFile, szPath);
			strcat(szFile, &szFileNames[index]);
			index += (int)strlen(&szFileNames[index])+1;

			hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
			if (hFile != INVALID_HANDLE_VALUE)
			{
				if (GetFileSize(hFile,  NULL) > 0)
			 	{
					hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);

					if (hMap) {
						pFile = (PBYTE)MapViewOfFile(hMap, FILE_MAP_COPY, 0, 0 ,0);

						if (pFile) {
							importSettings(hContact, (char*)pFile);
							UnmapViewOfFile(pFile);
						}
						CloseHandle(hMap);
					}

				}
				CloseHandle(hFile);
			}
			else
				break;

		}
		if (lstrcmp(FilePath, "") == 0)
			refreshTree(1);
	}
}
コード例 #18
0
void KWDocStruct::refreshEntireTree()
{
    refreshTree((int)(TextFrames | FormulaFrames | Tables | Pictures | Embedded));
}