Пример #1
0
void lmcBroadcastWindow::init(bool connected) {
	createToolBar();

	setWindowIcon(QIcon(IDR_APPICON));
	ui.splitter->setStyleSheet("QSplitter::handle { image: url("IDR_HGRIP"); }");

	ui.tvUserList->setIconSize(QSize(16, 16));
    ui.tvUserList->header()->setSectionsMovable(false);
	ui.tvUserList->header()->setStretchLastSection(false);
    ui.tvUserList->header()->setSectionResizeMode(0, QHeaderView::Stretch);
	ui.tvUserList->setCheckable(true);

	//	load settings
	pSettings = new lmcSettings();
	restoreGeometry(pSettings->value(IDS_WINDOWBROADCAST).toByteArray());
	ui.splitter->restoreState(pSettings->value(IDS_SPLITTERBROADCAST).toByteArray());
	showSmiley = pSettings->value(IDS_EMOTICON, IDS_EMOTICON_VAL).toBool();
	sendKeyMod = pSettings->value(IDS_SENDKEYMOD, IDS_SENDKEYMOD_VAL).toBool();
	fontSizeVal = pSettings->value(IDS_FONTSIZE, IDS_FONTSIZE_VAL).toInt();
	pFontGroup->actions()[fontSizeVal]->setChecked(true);
	int viewType = pSettings->value(IDS_USERLISTVIEW, IDS_USERLISTVIEW_VAL).toInt();
	ui.tvUserList->setView((UserListView)viewType);

	//	show a message if not connected
	bConnected = connected;
	ui.btnSend->setEnabled(bConnected);
	if(!bConnected)
		showStatus(IT_Disconnected, true);

	setUIText();

	ui.txtMessage->setStyleSheet("QTextEdit { " + fontStyle[fontSizeVal] + " }");
	ui.txtMessage->setFocus();
}
Пример #2
0
void lmcUpdateWindow::checkForUpdates() {
	ui->btnRecheck->setEnabled(false);
	status = US_Check;
	setUIText();

	emit messageSent(MT_Version, NULL, NULL);
}
Пример #3
0
void lmcAboutDialog::init(void) {
	setWindowIcon(QIcon(IDR_APPICON));

	pSettings = new lmcSettings();
	setUIText();

	ui.tabWidget->setCurrentIndex(0);
}
Пример #4
0
void lmcUpdateWindow::init(void) {
	setWindowIcon(QIcon(IDR_APPICON));
	ui->lblOutput->setBackgroundRole(QPalette::Base);
	ui->lblOutput->setAutoFillBackground(true);

	setUIText();
	checkForUpdates();
}
Пример #5
0
void lmcHelpWindow::init(void)
{
	setWindowIcon(QIcon(IDR_APPICON));

	pSettings = new lmcSettings();
	restoreGeometry(pSettings->value(IDS_WINDOWHELP).toByteArray());
	setUIText();
}
Пример #6
0
void wavrChatWindow::init(User *pLocalUser, User *pRemoteUser, bool connected) {
    localId = pLocalUser->id;
    localName = pLocalUser->name;

    peerId = pRemoteUser->id;
    peerIds.insert(peerId, pRemoteUser->id);
    peerNames.insert(peerId, pRemoteUser->name);
    peerStatuses.insert(peerId, pRemoteUser->status);
    peerCaps.insert(peerId, pRemoteUser->caps);

    this->pLocalUser = pLocalUser;

    pMessageLog->localId = localId;
    pMessageLog->peerId = peerId;
    pMessageLog->peerName = pRemoteUser->name;

    //  get the avatar image for the users
    pMessageLog->participantAvatars.insert(localId, pLocalUser->avatarPath);
    pMessageLog->participantAvatars.insert(peerId, pRemoteUser->avatarPath);

    createSmileyMenu();
    createToolBar();

    bConnected = connected;
    if(!bConnected)
        showStatus(IT_Disconnected, true);

    int index = wavrHelper::statusIndexFromCode(pRemoteUser->status);
    if(index != -1) {
        setWindowIcon(QIcon(statusPic[index]));
        if(statusType[index] == StatusTypeOffline)
            showStatus(IT_Offline, true);
        else if(statusType[index] == StatusTypeAway)
            showStatus(IT_Away, true);
        else if(statusType[index] == StatusTypeBusy)
            showStatus(IT_Busy, true);
    }

    pSettings = new wavrSettings();
    showSmiley = pSettings->value(IDS_EMOTICON, IDS_EMOTICON_VAL).toBool();
    pMessageLog->showSmiley = showSmiley;
    pMessageLog->autoFile = pSettings->value(IDS_AUTOFILE, IDS_AUTOFILE_VAL).toBool();
    pMessageLog->messageTime = pSettings->value(IDS_MESSAGETIME, IDS_MESSAGETIME_VAL).toBool();
    pMessageLog->messageDate = pSettings->value(IDS_MESSAGEDATE, IDS_MESSAGEDATE_VAL).toBool();
    pMessageLog->allowLinks = pSettings->value(IDS_ALLOWLINKS, IDS_ALLOWLINKS_VAL).toBool();
    pMessageLog->pathToLink = pSettings->value(IDS_PATHTOLINK, IDS_PATHTOLINK_VAL).toBool();
    pMessageLog->trimMessage = pSettings->value(IDS_TRIMMESSAGE, IDS_TRIMMESSAGE_VAL).toBool();
    clearOnClose = pSettings->value(IDS_CLEARONCLOSE, IDS_CLEARONCLOSE_VAL).toBool();

    setUIText();

    ui.txtMessage->setFocus();

    QString themePath = pSettings->value(IDS_THEME, IDS_THEME_VAL).toString();
    pMessageLog->initMessageLog(themePath);
    if(!clearOnClose)
        pMessageLog->restoreMessageLog(QDir(StdLocation::cacheDir()).absoluteFilePath("msg_" + peerId + ".tmp"));
}
Пример #7
0
void lmcAboutDialog::changeEvent(QEvent* pEvent) {
	switch(pEvent->type()) {
	case QEvent::LanguageChange:
		setUIText();
		break;
    default:
        break;
	}

	QDialog::changeEvent(pEvent);
}
Пример #8
0
void lmcMessageLog::changeEvent(QEvent* event) {
	switch(event->type()) {
	case QEvent::LanguageChange:
		setUIText();
		break;
	default:
		break;
	}

	QWidget::changeEvent(event);
}
Пример #9
0
void lmcBroadcastWindow::changeEvent(QEvent* pEvent) {
	switch(pEvent->type()) {
	case QEvent::LanguageChange:
		setUIText();
		break;
    default:
        break;
	}

	QWidget::changeEvent(pEvent);
}
Пример #10
0
void lmcMainWindow::init(User* pLocalUser, QList<Group>* pGroupList, bool connected) {
	setWindowIcon(QIcon(IDR_APPICON));
    setWindowFlags(windowFlags() & Qt::FramelessWindowHint);
    setWindowFlags(windowFlags() & ~Qt::WindowMaximizeButtonHint);
    setMinimumSize(270, 260);
    setMaximumSize(300, 760);

	this->pLocalUser = pLocalUser;

	createMainMenu();
	createToolBar();
	createStatusMenu();
	createAvatarMenu();

	createTrayMenu();
	createTrayIcon();
	connectionStateChanged(connected);

	createGroupMenu();
	createUserMenu();

	ui.lblDividerTop->setBackgroundRole(QPalette::Highlight);
	ui.lblDividerTop->setAutoFillBackground(true);

	ui.tvUserList->setIconSize(QSize(16, 16));
    ui.tvUserList->header()->setSectionsMovable(false);
	ui.tvUserList->header()->setStretchLastSection(false);
    ui.tvUserList->header()->setSectionResizeMode(0, QHeaderView::Stretch);
	btnStatus->setIconSize(QSize(20, 20));
	int index = Helper::statusIndexFromCode(pLocalUser->status);
	//	if status is not recognized, default to available
	index = qMax(index, 0);
	btnStatus->setIcon(QIcon(QPixmap(statusPic[index], "PNG")));
	statusGroup->actions()[index]->setChecked(true);
    QFont font = ui.lblUserName->font();
	int fontSize = ui.lblUserName->fontInfo().pixelSize();
	fontSize += (fontSize * 0.1);
	font.setPixelSize(fontSize);
    font.setBold(true);
    ui.lblUserName->setFont(font);
	ui.lblStatus->setText(statusGroup->checkedAction()->text());
	nAvatar = pLocalUser->avatar;
	ui.txtNote->setText(pLocalUser->note);

	pSoundPlayer = new lmcSoundPlayer();
	pSettings = new lmcSettings();
	restoreGeometry(pSettings->value(IDS_WINDOWMAIN).toByteArray());
	//	get saved settings
	settingsChanged(true);
	setUIText();

	initGroups(pGroupList);
}
Пример #11
0
void lmcUpdateWindow::receiveMessage(MessageType type, QString *lpszUserId, XmlMessage *pMessage) {
	Q_UNUSED(lpszUserId);

	switch(type) {
	case MT_Version:
		webVersion = pMessage->data(XN_VERSION);
		if(Helper::compareVersions(webVersion, QString(IDA_VERSION)) > 0)
			status = US_New;	// newer version available online
		else
			status = US_Latest;
		setUIText();
		break;
	case MT_WebFailed:
		status = US_Error;
		setUIText();
		break;
	default:
		break;
	}

	ui->btnRecheck->setEnabled(true);
}
Пример #12
0
void wavrChatWindow::changeEvent(QEvent* pEvent) {
    switch(pEvent->type()) {
    case QEvent::ActivationChange:
        if(isActiveWindow())
            setWindowTitle(getWindowTitle());
        break;
    case QEvent::LanguageChange:
        setUIText();
        break;
    default:
        break;
    }

    QWidget::changeEvent(pEvent);
}
Пример #13
0
void lmcTransferWindow::init(void) {
	setWindowIcon(QIcon(IDR_APPICON));

	createToolBar();
	setButtonState(FileView::TS_Max);

	pSettings = new lmcSettings();
	restoreGeometry(pSettings->value(IDS_WINDOWTRANSFERS).toByteArray());
	setUIText();

	ui.lvTransferList->loadData(StdLocation::transferHistory());
	if(ui.lvTransferList->count() > 0)
		ui.lvTransferList->setCurrentRow(0);

	pSoundPlayer = new lmcSoundPlayer();
}
Пример #14
0
void lmcChatRoomWindow::init(User* pLocalUser, bool connected, QString thread)
{
	localId = pLocalUser->id;
	localName = pLocalUser->name;

	this->pLocalUser = pLocalUser;

	pMessageLog->localId = localId;

	//	get the avatar image for the users from the cache folder
	QDir cacheDir(StdLocation::cacheDir());
	QString fileName = "avt_" + localId + ".png";
	QString filePath = cacheDir.absoluteFilePath(fileName);
	pMessageLog->participantAvatars.insert(localId, filePath);

	threadId = thread;
	groupMode = !threadId.isNull();

	createUserMenu();
	createSmileyMenu();
	createToolBar();

	bConnected = connected;
    if ( !bConnected )
        showStatus( IT_Disconnected, true );

	pSoundPlayer = new lmcSoundPlayer();

	ui.tvUserList->setIconSize(QSize(16, 16));
    ui.tvUserList->header()->setSectionsMovable(false);
	ui.tvUserList->header()->setStretchLastSection(false);
    ui.tvUserList->header()->setSectionResizeMode(0, QHeaderView::Stretch);

	lmcUserTreeWidgetGroupItem *pItem = new lmcUserTreeWidgetGroupItem();
	pItem->setData(0, IdRole, GroupId);
	pItem->setData(0, TypeRole, "Group");
	pItem->setText(0, "Participants");
	pItem->setSizeHint(0, QSize(0, 22));
	ui.tvUserList->addTopLevelItem(pItem);
	ui.tvUserList->expandAll();

	pSettings = new lmcSettings();
	showSmiley = pSettings->value(IDS_EMOTICON, IDS_EMOTICON_VAL).toBool();
	pMessageLog->showSmiley = showSmiley;
	pMessageLog->autoFile = pSettings->value(IDS_AUTOFILE, IDS_AUTOFILE_VAL).toBool();
	pMessageLog->fontSizeVal = pSettings->value(IDS_FONTSIZE, IDS_FONTSIZE_VAL).toInt();
	pMessageLog->messageTime = pSettings->value(IDS_MESSAGETIME, IDS_MESSAGETIME_VAL).toBool();
	pMessageLog->messageDate = pSettings->value(IDS_MESSAGEDATE, IDS_MESSAGEDATE_VAL).toBool();
	pMessageLog->allowLinks = pSettings->value(IDS_ALLOWLINKS, IDS_ALLOWLINKS_VAL).toBool();
	pMessageLog->pathToLink = pSettings->value(IDS_PATHTOLINK, IDS_PATHTOLINK_VAL).toBool();
	pMessageLog->trimMessage = pSettings->value(IDS_TRIMMESSAGE, IDS_TRIMMESSAGE_VAL).toBool();
	QFont font = QApplication::font();
	font.fromString(pSettings->value(IDS_FONT, IDS_FONT_VAL).toString());
	messageColor = QApplication::palette().text().color();
	messageColor.setNamedColor(pSettings->value(IDS_COLOR, IDS_COLOR_VAL).toString());
	sendKeyMod = pSettings->value(IDS_SENDKEYMOD, IDS_SENDKEYMOD_VAL).toBool();

    if ( !groupMode )
    {
		restoreGeometry(pSettings->value(IDS_WINDOWPUBLICCHAT).toByteArray());
		ui.vSplitter->restoreState(pSettings->value(IDS_SPLITTERPUBLICCHATV).toByteArray());
		ui.hSplitter->restoreState(pSettings->value(IDS_SPLITTERPUBLICCHATH).toByteArray());
	}

	setUIText();

    setMessageFont( font );
    ui.txtMessage->setStyleSheet( "QTextEdit {color: " + messageColor.name() + ";}" );
	ui.txtMessage->setFocus();

	QString themePath = pSettings->value(IDS_THEME, IDS_THEME_VAL).toString();
	pMessageLog->initMessageLog(themePath);

	int viewType = pSettings->value(IDS_USERLISTVIEW, IDS_USERLISTVIEW_VAL).toInt();
	ui.tvUserList->setView((UserListView)viewType);

	//	Destroy the window when it closes if in group mode
	setAttribute(Qt::WA_DeleteOnClose, groupMode);

	//	Add the local user as a participant
	addUser(pLocalUser);
}