void ReportWizard::on_pushButton_submit_clicked()
{
    QDate startDate = ui->dateEdit_startDate->date(), endDate = ui->dateEdit_endDate->date();
    if (endDate < startDate)
    {
        showErrorDialog("Start date must be before end date");
        return;
    }

    QString reportPath = SettingForm::getPdfDirectoryWithoutSlash() + "/reports";
    if (!QDir(reportPath).exists()) QDir().mkpath(reportPath);

    QString suggestedFilename
            = reportPath + "/report_" + toString(startDate.day()).c_str()
            + QDate::longMonthName(startDate.month()) + toString(startDate.year()).c_str() + "_to_"
            + toString(endDate.day()).c_str() + QDate::longMonthName(endDate.month()) + '_'
            + toString(endDate.year()).c_str() + ".pdf";

    QString filename = QFileDialog::getSaveFileName(this, "Save Report As", suggestedFilename, "PDF (*.pdf)");
    if (filename.isEmpty()) return;

    if (PdfGenerator::generateReport(filename.toStdString().c_str(), startDate, endDate))
    {
        showInfoDialog("Report generated successfully");
        QDesktopServices::openUrl(QUrl("file:///" + filename));
        done(Accepted);
    }
    else showErrorDialog("Report could not be generated");
}
Ejemplo n.º 2
0
void IGameEventRealizer::showInfoDialog(const std::string &msg, PlayerColor player)
{
	InfoWindow iw;
	iw.player = player;
	iw.text << msg;
	showInfoDialog(&iw);
}
Ejemplo n.º 3
0
void MainWindow::toggleInfoDialog(const QString& title, const QString& htmlInfo)
{
	if ( ! infoDialog )
		return showInfoDialog(title, htmlInfo);
	infoDialog->setInfo(title, htmlInfo);
	infoDialog->isVisible() ? infoDialog->hide() : infoDialog->show();
}
Ejemplo n.º 4
0
void MainWindow::on_pushButton_exportXml_released()
{
    QString filename = QFileDialog::getSaveFileName(this, "Export Database To", "database.xml", "XML (*.xml)");
    if (filename.isEmpty()) return;
    Databases::exportXml(filename.toStdString().c_str());
    showInfoDialog("Database exported successfully");
}
Ejemplo n.º 5
0
static int infoBox(char *file, HWND hwndParent)
{
	char filename[MAX_PATH];
	int song;
	song = extractSongNumber(file, filename);
	showInfoDialog(mod.hDllInstance, hwndParent, filename, song);
	return 0;
}
void CustomerShow::on_pushButton_delete_released()
{
    if (!showYesNoDialog("Are you sure you want to delete this customer?")) return;

    if (CustomerController::Destroy(customer, this))
    {
        showInfoDialog("The customer was deleted successfully");
        done(Accepted);
    }
}
Ejemplo n.º 7
0
void SharedFoldersWidget::itemDoubleClicked(QTableWidgetItem *item)
{
	QString selectedSecret = item->data(Qt::UserRole).toString();

	if(selectedSecret.isEmpty())
	{
		qCritical("No secret associated with row!");
		return;
	}

	showInfoDialog(selectedSecret);
}
Ejemplo n.º 8
0
void CGKeymasterTent::onHeroVisit( const CGHeroInstance * h ) const
{
	int txt_id;
	if (!wasMyColorVisited (h->getOwner()) )
	{
		cb->setObjProperty(id, h->tempOwner.getNum()+101, subID);
		txt_id=19;
	}
	else
		txt_id=20;
	showInfoDialog(h,txt_id,soundBase::CAVEHEAD);
}
Ejemplo n.º 9
0
void CGBorderGate::onHeroVisit( const CGHeroInstance * h ) const //TODO: passability
{
	if (!wasMyColorVisited (h->getOwner()) )
	{
		showInfoDialog(h,18,0);

		AddQuest aq;
		aq.quest = QuestInfo (quest, this, visitablePos());
		aq.player = h->tempOwner;
		cb->sendAndApply (&aq);
	}
}
Ejemplo n.º 10
0
void CGHeroInstance::onHeroVisit(const CGHeroInstance * h) const
{
	if(h == this) return; //exclude potential self-visiting

	if (ID == Obj::HERO)
	{
		if( cb->gameState()->getPlayerRelations(tempOwner, h->tempOwner)) //our or ally hero
		{
			//exchange
			cb->heroExchange(h->id, id);
		}
		else //battle
		{
			if(visitedTown) //we're in town
				visitedTown->onHeroVisit(h); //town will handle attacking
			else
				cb->startBattleI(h,	this);
		}
	}
	else if(ID == Obj::PRISON)
	{
		int txt_id;

		if (cb->getHeroCount(h->tempOwner, false) < VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER)//GameConstants::MAX_HEROES_PER_PLAYER) //free hero slot
		{
			cb->changeObjPos(id,pos+int3(1,0,0),0);
			//update hero parameters
			SetMovePoints smp;
			smp.hid = id;
			smp.val = maxMovePoints (true); //TODO: hota prison on water?
			cb->setMovePoints (&smp);
			cb->setManaPoints (id, manaLimit());

			cb->setObjProperty(id, ObjProperty::ID, Obj::HERO); //set ID to 34
			cb->giveHero(id,h->tempOwner); //recreates def and adds hero to player

			txt_id = 102;
		}
		else //already 8 wandering heroes
		{
			txt_id = 103;
		}

		showInfoDialog(h,txt_id,soundBase::ROGUE);
	}
}
Ejemplo n.º 11
0
void PBase::onPopupMenuClick( Node* node, WJTouchEvent* event )
{
    int tag = node->getTag();

    switch (tag)
    {
    case MENU_TAG_POPUP:
        Common::sound.play("Common:button");
        break;

    case MENU_TAG_GOHOME:
        Loading::gotoScene(GameNumber::P000);
        Common::sound.play("Common:button");
        break;

    case MENU_TAG_BACK:
        Loading::gotoScene(GameNumber::P010);
        Common::sound.play("Common:button");
        break;

    case MENU_TAG_MOREGAME:
        Common::sound.play("Common:popup");
#if (DEBUG_SHOW_TEST_MENU)
        TestGameMenu::show();
#else
        WJUtils::showMoreGameDialog(THIS_APP_ID, URL_MOREGAME_DEF);
#endif

        break;

    case MENU_TAG_RATE:
        showInfoDialog();
        break;

    case MENU_TAG_STORE:
        Store::showStore();
        break;

    case MENU_TAG_CAMERA:
        if (WJUtils::canClick("camera", 2000))
        {
            showSnapshot();
        }
        break;
    }
}
Ejemplo n.º 12
0
void MainWindow::on_pushButton_generateReport_clicked()
{
    QDate date = ui->calendar->selectedDate();

    QString saveFolder = SettingForm::getPdfDirectoryWithoutSlash() + "/reports/" + toString(date.year()).c_str();
    QString filename
            = saveFolder + "/report_" + QDate::longMonthName(date.month()) + "_" + toString(date.year()).c_str()
            + ".pdf";

    if (!QDir(saveFolder).exists()) QDir().mkpath(saveFolder);

    if (PdfGenerator::generateReport((filename).toStdString().c_str(), date.month(), date.year()))
    {
        showInfoDialog("Report generated successfully");
        QDesktopServices::openUrl(QUrl("file:///" + filename));
    }
    else showErrorDialog("Report could not be generated");
}
Ejemplo n.º 13
0
void SharedFoldersWidget::folderInfo()
{
	if(!api || !client || !client->isClientReady())
		return;

	QTableWidgetItem *item = getSelectedRow(foldersTable);

	if(!item)
		return;

	QString selectedSecret = item->data(Qt::UserRole).toString();

	if(selectedSecret.isEmpty())
	{
		qCritical("No secret associated with row!");
		return;
	}

	showInfoDialog(selectedSecret);
}
Ejemplo n.º 14
0
void CGBorderGuard::onHeroVisit( const CGHeroInstance * h ) const
{
	if (wasMyColorVisited (h->getOwner()) )
	{
		BlockingDialog bd (true, false);
		bd.player = h->getOwner();
		bd.soundID = soundBase::QUEST;
		bd.text.addTxt (MetaString::ADVOB_TXT, 17);
		cb->showBlockingDialog (&bd);
	}
	else
	{
		showInfoDialog(h,18,soundBase::CAVEHEAD);

		AddQuest aq;
		aq.quest = QuestInfo (quest, this, visitablePos());
		aq.player = h->tempOwner;
		cb->sendAndApply (&aq);
		//TODO: add this quest only once OR check for multiple instances later
	}
}
Ejemplo n.º 15
0
void CGObjectInstance::onHeroVisit( const CGHeroInstance * h ) const
{
	switch(ID)
	{
	case Obj::HILL_FORT:
		{
			openWindow(OpenWindow::HILL_FORT_WINDOW,id.getNum(),h->id.getNum());
		}
		break;
	case Obj::SANCTUARY:
		{
			//You enter the sanctuary and immediately feel as if a great weight has been lifted off your shoulders.  You feel safe here.
			showInfoDialog(h, 114);
		}
		break;
	case Obj::TAVERN:
		{
			openWindow(OpenWindow::TAVERN_WINDOW,h->id.getNum(),id.getNum());
		}
		break;
	}
}
Ejemplo n.º 16
0
void P001::onToolbarClick( Node* node, WJTouchEvent* evnet )
{
	int tag = node->getTag();
	switch (tag)
	{
	case MENU_TAG_FORPARENTS:
		Common::sound.play("Common:button");

		if (DEBUG_APP)
			TestGameMenu::show();
		else
			WJUtils::showForParentDialog(THIS_APP_ID, URL_FOR_PARENTS);

		break;

	case MENU_TAG_INFO:
		showInfoDialog();
		break;

	case MENU_TAG_STORE:
		Store::showStore();
		break;
	}
}
Ejemplo n.º 17
0
void MusicListView::showContextMenu(const QPoint &pos,
                                    PlaylistPtr selectedPlaylist,
                                    PlaylistPtr favPlaylist,
                                    QList<PlaylistPtr> newPlaylists)
{
    Q_D(MusicListView);
    QItemSelectionModel *selection = this->selectionModel();

    if (selection->selectedRows().length() <= 0) {
        return;
    }

    QPoint globalPos = this->mapToGlobal(pos);

    QMenu playlistMenu;
    playlistMenu.setStyle(QStyleFactory::create("dlight"));

    auto newvar = QVariant::fromValue(PlaylistPtr());

    auto createPlaylist = playlistMenu.addAction(tr("New playlist"));
    createPlaylist->setData(newvar);
    createPlaylist->setIcon(QIcon(":/light/image/plus.svg"));

    playlistMenu.addSeparator();

    if (selectedPlaylist != favPlaylist) {
        auto act = playlistMenu.addAction(favPlaylist->displayName());
        act->setData(QVariant::fromValue(favPlaylist));
    }

    for (auto playlist : newPlaylists) {
        QFont font(playlistMenu.font());
        QFontMetrics fm(font);
        auto text = fm.elidedText(QString(playlist->displayName().replace("&", "&&")),
                                  Qt::ElideMiddle, 160);
        auto act = playlistMenu.addAction(text);
        act->setData(QVariant::fromValue(playlist));
    }

    connect(&playlistMenu, &QMenu::triggered, this, [ = ](QAction * action) {
        auto playlist = action->data().value<PlaylistPtr >();
        qDebug() << playlist;
        MetaPtrList metalist;
        for (auto &index : selection->selectedRows()) {
            auto meta = d->model->meta(index);
            if (!meta.isNull()) {
                metalist << meta;
            }
        }
        Q_EMIT addToPlaylist(playlist, metalist);
    });

    bool singleSelect = (1 == selection->selectedRows().length());

    QMenu myMenu;
    myMenu.setStyle(QStyleFactory::create("dlight"));

    QAction *playAction = nullptr;
    if (singleSelect) {
        playAction = myMenu.addAction(tr("Play"));
    }
    myMenu.addAction(tr("Add to playlist"))->setMenu(&playlistMenu);
    myMenu.addSeparator();

    QAction *displayAction = nullptr;
    if (singleSelect) {
        displayAction = myMenu.addAction(tr("Display in file manager"));
    }

    auto removeAction = myMenu.addAction(tr("Remove from playlist"));
    auto deleteAction = myMenu.addAction(tr("Delete from local disk"));

    QAction *songAction = nullptr;

    QMenu textCodecMenu;
    textCodecMenu.setStyle(QStyleFactory::create("dlight"));

    if (singleSelect) {
        auto index = selection->selectedRows().first();
        auto meta = d->model->meta(index);
        QList<QByteArray> codecList = DMusic::detectMetaEncodings(meta);
//        codecList << "utf-8" ;
        for (auto codec : codecList) {
            auto act = textCodecMenu.addAction(codec);
            act->setData(QVariant::fromValue(codec));
        }

        if (codecList.length() > 1) {
            myMenu.addSeparator();
            myMenu.addAction(tr("Encoding"))->setMenu(&textCodecMenu);
        }

        myMenu.addSeparator();
        songAction = myMenu.addAction(tr("Song info"));

        connect(&textCodecMenu, &QMenu::triggered, this, [ = ](QAction * action) {
            auto codec = action->data().toByteArray();
            meta->updateCodec(codec);
            Q_EMIT updateMetaCodec(meta);
        });
    }

    if (playAction) {
        connect(playAction, &QAction::triggered, this, [ = ](bool) {
            auto index = selection->selectedRows().first();
            Q_EMIT playMedia(d->model->meta(index));
        });
    }

    if (displayAction) {
        connect(displayAction, &QAction::triggered, this, [ = ](bool) {
            auto index = selection->selectedRows().first();
            auto meta = d->model->meta(index);
            auto dirUrl = QUrl::fromLocalFile(meta->localPath);
            Dtk::Widget::DDesktopServices::showFileItem(dirUrl);
        });
    }

    if (removeAction) {
        connect(removeAction, &QAction::triggered, this, [ = ](bool) {
            d->removeSelection(selection);
        });
    }

    if (deleteAction) {
        connect(deleteAction, &QAction::triggered, this, [ = ](bool) {
            bool containsCue = false;
            MetaPtrList metalist;
            for (auto index : selection->selectedRows()) {
                auto meta = d->model->meta(index);
                if (!meta->cuePath.isEmpty()) {
                    containsCue = true;
                }
                metalist << meta;
            }

            Dtk::Widget::DDialog warnDlg(this);
            warnDlg.setStyle(QStyleFactory::create("dlight"));
            warnDlg.setTextFormat(Qt::RichText);
            warnDlg.addButton(tr("Cancel"), true, Dtk::Widget::DDialog::ButtonWarning);
            warnDlg.addButton(tr("Delete"), false, Dtk::Widget::DDialog::ButtonNormal);

            auto cover = QImage(QString(":/common/image/del_notify.svg"));
            if (1 == metalist.length()) {
                auto meta = metalist.first();
                auto coverData = MetaSearchService::coverData(meta);
                if (coverData.length() > 0) {
                    cover = QImage::fromData(coverData);
                }
                warnDlg.setMessage(QString(tr("Are you sure you want to delete %1?")).arg(meta->title));
            } else {
                warnDlg.setMessage(QString(tr("Are you sure you want to delete the selected %1 songs?")).arg(metalist.length()));
            }

            if (containsCue) {
                warnDlg.setTitle(tr("Are you sure you want to delete the selected %1 songs?").arg(metalist.length()));
                warnDlg.setMessage(tr("Deleting the current song will also delete the song files contained"));
            }
            auto coverPixmap =  QPixmap::fromImage(WidgetHelper::cropRect(cover, QSize(64, 64)));

            warnDlg.setIcon(QIcon(coverPixmap));
            if (0 == warnDlg.exec()) {
                return;
            }
            Q_EMIT deleteMusicList(metalist);
        });
    }

    if (songAction) {
        connect(songAction, &QAction::triggered, this, [ = ](bool) {
            auto index = selection->selectedRows().first();
            auto meta = d->model->meta(index);
            Q_EMIT showInfoDialog(meta);
        });
    }

    myMenu.exec(globalPos);
}
Ejemplo n.º 18
0
	void __cdecl AdditionalInfo(char *filename, int audioDataOffset)
	{
		showInfoDialog(hInstance, GetActiveWindow(), filename, -1);
	}
Ejemplo n.º 19
0
static void showInfoDialog(const CGHeroInstance* h, const ui32 txtID, const ui16 soundID)
{
	const PlayerColor playerID = h->getOwner();
	showInfoDialog(playerID,txtID,soundID);
}
Ejemplo n.º 20
0
Archivo: wasap.c Proyecto: 070499/xbmc
static LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	int idc;
	POINT pt;
	PCOPYDATASTRUCT pcds;
	switch (msg) {
	case WM_COMMAND:
		idc = LOWORD(wParam);
		switch (idc) {
		case IDM_OPEN:
			SelectAndLoadFile();
			break;
		case IDM_STOP:
			StopPlayback();
			break;
		case IDM_FILE_INFO:
			showInfoDialog(hInst, hWnd, current_filename, current_song);
			break;
		case IDM_SAVE_WAV:
			SaveWav();
			break;
		case IDM_ABOUT:
			ShowAbout();
			break;
		case IDM_EXIT:
			PostQuitMessage(0);
			break;
		default:
			if (idc >= IDM_SONG1 && idc < IDM_SONG1 + songs)
				LoadAndPlay(idc - IDM_SONG1);
			break;
		}
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	case MYWM_NOTIFYICON:
		if (opening) {
			SetForegroundWindow(GetLastActivePopup(hWnd));
			break;
		}
		switch (lParam) {
		case WM_LBUTTONDOWN:
			SelectAndLoadFile();
			break;
		case WM_MBUTTONDOWN:
			if (songs <= 1)
				break;
			/* FALLTHROUGH */
		case WM_RBUTTONUP:
			GetCursorPos(&pt);
			SetForegroundWindow(hWnd);
			TrackPopupMenu(lParam == WM_MBUTTONDOWN ? hSongMenu : hTrayMenu,
				TPM_RIGHTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON,
				pt.x, pt.y, 0, hWnd, NULL);
			PostMessage(hWnd, WM_NULL, 0, 0);
			break;
		default:
			break;
		}
		break;
	case WM_COPYDATA:
		pcds = (PCOPYDATASTRUCT) lParam;
		if (pcds->dwData == 'O' && pcds->cbData <= sizeof(current_filename)) {
			if (errorShown) {
				HWND hChild = GetLastActivePopup(hWnd);
				if (hChild != hWnd)
					SendMessage(hChild, WM_CLOSE, 0, 0);
			}
			memcpy(current_filename, pcds->lpData, pcds->cbData);
			LoadAndPlay(-1);
		}
		break;
	default:
		if (msg == taskbarCreatedMessage)
			Shell_NotifyIcon(NIM_ADD, &nid);
		return DefWindowProc(hWnd, msg, wParam, lParam);
	}
	return 0;
}