Exemple #1
0
static void lamexp_print_logo(void)
{
	//Print version info
	qDebug("LameXP - Audio Encoder Front-End v%d.%02d %s (Build #%03d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build());
	qDebug("Copyright (c) 2004-%04d LoRd_MuldeR <*****@*****.**>. Some rights reserved.", qMax(MUtils::Version::app_build_date().year(), MUtils::OS::current_date().year()));
	qDebug("Built on %s at %s with %s for Win-%s.\n", MUTILS_UTF8(MUtils::Version::app_build_date().toString(Qt::ISODate)), MUTILS_UTF8(MUtils::Version::app_build_time().toString(Qt::ISODate)), MUtils::Version::compiler_version(), MUtils::Version::compiler_arch());
	
	//print license info
	qDebug("This program is free software: you can redistribute it and/or modify");
	qDebug("it under the terms of the GNU General Public License <http://www.gnu.org/>.");
	qDebug("Note that this program is distributed with ABSOLUTELY NO WARRANTY.\n");

	//Print library version
	qDebug("This application is powerd by MUtils library v%u.%02u (%s, %s).\n", MUtils::Version::lib_version_major(), MUtils::Version::lib_version_minor(), MUTILS_UTF8(MUtils::Version::lib_build_date().toString(Qt::ISODate)), MUTILS_UTF8(MUtils::Version::lib_build_time().toString(Qt::ISODate)));
	
	//Print warning, if this is a "debug" build
	if(MUTILS_DEBUG)
	{
		qWarning("---------------------------------------------------------");
		qWarning("DEBUG BUILD: DO NOT RELEASE THIS BINARY TO THE PUBLIC !!!");
		qWarning("---------------------------------------------------------\n");
	}
}
Exemple #2
0
ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel *metaInfo, SettingsModel *settings, QWidget *parent)
:
	QDialog(parent),
	ui(new Ui::ProcessingDialog),
	//m_aacEncoder(SettingsModel::getAacEncoder()),
	m_systemTray(new QSystemTrayIcon(QIcon(":/icons/cd_go.png"), this)),
	m_settings(settings),
	m_metaInfo(metaInfo),
	m_shutdownFlag(shutdownFlag_None),
	m_diskObserver(NULL),
	m_cpuObserver(NULL),
	m_ramObserver(NULL),
	m_progressViewFilter(-1),
	m_firstShow(true)
{
	//Init the dialog, from the .ui file
	ui->setupUi(this);
	setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
	
	//Update header icon
	ui->label_headerIcon->setPixmap(lamexp_app_icon().pixmap(ui->label_headerIcon->size()));
	
	//Setup version info
	ui->label_versionInfo->setText(QString().sprintf("v%d.%02d %s (Build %d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build()));
	ui->label_versionInfo->installEventFilter(this);

	//Register meta type
	qRegisterMetaType<QUuid>("QUuid");

	//Center window in screen
	QRect desktopRect = QApplication::desktop()->screenGeometry();
	QRect thisRect = this->geometry();
	move((desktopRect.width() - thisRect.width()) / 2, (desktopRect.height() - thisRect.height()) / 2);
	setMinimumSize(thisRect.width(), thisRect.height());

	//Enable buttons
	connect(ui->button_AbortProcess, SIGNAL(clicked()), this, SLOT(abortEncoding()));
	
	//Init progress indicator
	m_progressIndicator = new QMovie(":/images/Working.gif");
	m_progressIndicator->setCacheMode(QMovie::CacheAll);
	m_progressIndicator->setSpeed(50);
	ui->label_headerWorking->setMovie(m_progressIndicator);
	ui->progressBar->setValue(0);

	//Init progress model
	m_progressModel = new ProgressModel();
	ui->view_log->setModel(m_progressModel);
	ui->view_log->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
	ui->view_log->verticalHeader()->hide();
	ui->view_log->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
	ui->view_log->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
	ui->view_log->viewport()->installEventFilter(this);
	connect(m_progressModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(progressModelChanged()));
	connect(m_progressModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(progressModelChanged()));
	connect(m_progressModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(progressModelChanged()));
	connect(m_progressModel, SIGNAL(modelReset()), this, SLOT(progressModelChanged()));
	connect(ui->view_log, SIGNAL(activated(QModelIndex)), this, SLOT(logViewDoubleClicked(QModelIndex)));
	connect(ui->view_log->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(logViewSectionSizeChanged(int,int,int)));

	//Create context menu
	m_contextMenu = new QMenu();
	QAction *contextMenuDetailsAction = m_contextMenu->addAction(QIcon(":/icons/zoom.png"), tr("Show details for selected job"));
	QAction *contextMenuShowFileAction = m_contextMenu->addAction(QIcon(":/icons/folder_go.png"), tr("Browse Output File Location"));
	m_contextMenu->addSeparator();

	//Create "filter" context menu
	m_progressViewFilterGroup = new QActionGroup(this);
	QAction *contextMenuFilterAction[5] = {NULL, NULL, NULL, NULL, NULL};
	if(QMenu *filterMenu = m_contextMenu->addMenu(QIcon(":/icons/filter.png"), tr("Filter Log Items")))
	{
		contextMenuFilterAction[0] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobRunning), tr("Show Running Only"));
		contextMenuFilterAction[1] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobComplete), tr("Show Succeeded Only"));
		contextMenuFilterAction[2] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobFailed), tr("Show Failed Only"));
		contextMenuFilterAction[3] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobSkipped), tr("Show Skipped Only"));
		contextMenuFilterAction[4] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobState(-1)), tr("Show All Items"));
		if(QAction *act = contextMenuFilterAction[0]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobRunning); }
		if(QAction *act = contextMenuFilterAction[1]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobComplete); }
		if(QAction *act = contextMenuFilterAction[2]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobFailed); }
		if(QAction *act = contextMenuFilterAction[3]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobSkipped); }
		if(QAction *act = contextMenuFilterAction[4]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(-1); act->setChecked(true); }
	}

	//Create info label
	if(m_filterInfoLabel = new QLabel(ui->view_log))
	{
		m_filterInfoLabel->setFrameShape(QFrame::NoFrame);
		m_filterInfoLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
		m_filterInfoLabel->setUserData(0, new IntUserData(-1));
		SET_FONT_BOLD(m_filterInfoLabel, true);
		SET_TEXT_COLOR(m_filterInfoLabel, Qt::darkGray);
		m_filterInfoLabel->setContextMenuPolicy(Qt::CustomContextMenu);
		connect(m_filterInfoLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
		m_filterInfoLabel->hide();
	}
	if(m_filterInfoLabelIcon = new QLabel(ui->view_log))
	{
		m_filterInfoLabelIcon->setFrameShape(QFrame::NoFrame);
		m_filterInfoLabelIcon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
		m_filterInfoLabelIcon->setContextMenuPolicy(Qt::CustomContextMenu);
		const QIcon &ico = m_progressModel->getIcon(ProgressModel::JobState(-1));
		m_filterInfoLabelIcon->setPixmap(ico.pixmap(16, 16));
		connect(m_filterInfoLabelIcon, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
		m_filterInfoLabelIcon->hide();
	}

	//Connect context menu
	ui->view_log->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(ui->view_log, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
	connect(contextMenuDetailsAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuDetailsActionTriggered()));
	connect(contextMenuShowFileAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuShowFileActionTriggered()));
	for(size_t i = 0; i < 5; i++)
	{
		if(contextMenuFilterAction[i]) connect(contextMenuFilterAction[i], SIGNAL(triggered(bool)), this, SLOT(contextMenuFilterActionTriggered()));
	}
	SET_FONT_BOLD(contextMenuDetailsAction, true);

	//Enque jobs
	if(fileListModel)
	{
		for(int i = 0; i < fileListModel->rowCount(); i++)
		{
			m_pendingJobs.append(fileListModel->getFile(fileListModel->index(i,0)));
		}
	}

	//Translate
	ui->label_headerStatus->setText(QString("<b>%1</b><br>%2").arg(tr("Encoding Files"), tr("Your files are being encoded, please be patient...")));
	
	//Enable system tray icon
	connect(m_systemTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(systemTrayActivated(QSystemTrayIcon::ActivationReason)));

	//Init other vars
	m_runningThreads = 0;
	m_currentFile = 0;
	m_allJobs.clear();
	m_succeededJobs.clear();
	m_failedJobs.clear();
	m_skippedJobs.clear();
	m_userAborted = false;
	m_forcedAbort = false;
	m_timerStart = 0I64;
}
Exemple #3
0
AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart)
    :
    QMessageBox(parent),
    m_settings(settings),
    m_disque(NULL),
    m_disqueTimer(NULL),
    m_rotateNext(false),
    m_disqueDelay(_I64_MAX)
{
    const QString versionStr = QString().sprintf
                               (
                                   "Version %d.%02d %s, Build %d [%s], %s %s, Qt v%s",
                                   lamexp_version_major(),
                                   lamexp_version_minor(),
                                   lamexp_version_release(),
                                   lamexp_version_build(),
                                   lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(),
                                   lamexp_version_compiler(),
                                   lamexp_version_arch(),
                                   qVersion()
                               );
    const QString copyrightStr = QString().sprintf
                                 (
                                     "Copyright (C) 2004-%04d LoRd_MuldeR &lt;[email protected]&gt;. Some rights reserved.",
                                     qMax(lamexp_version_date().year(), QDate::currentDate().year())
                                 );

    for(int i = 0; i < 4; i++)
    {
        m_cartoon[i] = NULL;
    }

    QString aboutText;

    aboutText += QString("<h2>%1</h2>").arg(NOBR(tr("LameXP - Audio Encoder Front-end")));
    aboutText += QString("<b>%1</b><br>").arg(NOBR(copyrightStr));
    aboutText += QString("<b>%1</b><br><br>").arg(NOBR(versionStr));
    aboutText += QString("%1<br>").arg(NOBR(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))));

    if(LAMEXP_DEBUG)
    {
        int daysLeft = qMax(QDate::currentDate().daysTo(lamexp_version_expires()), 0);
        aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(QString("!!! --- DEBUG BUILD --- Expires at: %1 &middot; Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
    }
    else if(lamexp_version_demo())
    {
        int daysLeft = qMax(QDate::currentDate().daysTo(lamexp_version_expires()), 0);
        aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(tr("Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left.").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
    }

    aboutText += "<hr><br>";
    aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or<br>";
    aboutText += "modify it under the terms of the GNU General Public License<br>";
    aboutText += "as published by the Free Software Foundation; either version 2<br>";
    aboutText += "of the License, or (at your option) any later version.<br><br>";
    aboutText += "This program is distributed in the hope that it will be useful,<br>";
    aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
    aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>";
    aboutText += "GNU General Public License for more details.<br><br>";
    aboutText += "You should have received a copy of the GNU General Public License<br>";
    aboutText += "along with this program; if not, write to the Free Software<br>";
    aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110&minus;1301, USA.</tt></nobr><br>";
    aboutText += "<hr><table><tr>";
    aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td>&nbsp;</td>";
    aboutText += QString("<td><font color=\"darkred\">%1</font></td>").arg(tr("Note: LameXP is free software. Do <b>not</b> pay money to obtain or use LameXP! If some third-party website tries to make you pay for downloading LameXP, you should <b>not</b> respond to the offer !!!"));
    aboutText += "</tr></table><hr><br>";
    aboutText += QString("%1<br>").arg(NOBR(tr("Special thanks go out to \"John33\" from %1 for his continuous support.")).arg(LINK("http://www.rarewares.org/")));

    setText(aboutText);
    setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
    setWindowTitle(tr("About LameXP"));

    if(firstStart)
    {
        QPushButton *firstButton = addButton(tr("Show License Text"), QMessageBox::AcceptRole);
        firstButton->setIcon(QIcon(":/icons/script.png"));
        firstButton->setIconSize(QSize(16, 16));
        firstButton->setMinimumWidth(135);
        firstButton->disconnect();
        connect(firstButton, SIGNAL(clicked()), this, SLOT(openLicenseText()));

        QPushButton *secondButton = addButton(tr("Accept License"), QMessageBox::AcceptRole);
        secondButton->setIcon(QIcon(":/icons/accept.png"));
        secondButton->setIconSize(QSize(16, 16));
        secondButton->setMinimumWidth(120);

        QPushButton *thirdButton = addButton(tr("Decline License"), QMessageBox::AcceptRole);
        thirdButton->setIcon(QIcon(":/icons/delete.png"));
        thirdButton->setIconSize(QSize(16, 16));
        thirdButton->setMinimumWidth(120);
        thirdButton->setEnabled(false);
    }
    else
    {
        QPushButton *firstButton = addButton(tr("3rd Party S/W"), QMessageBox::AcceptRole);
        firstButton->setIcon(QIcon(":/icons/page_white_cplusplus.png"));
        firstButton->setIconSize(QSize(16, 16));
        firstButton->setMinimumWidth(120);
        firstButton->disconnect();
        connect(firstButton, SIGNAL(clicked()), this, SLOT(showMoreAbout()));

        QPushButton *secondButton = addButton(tr("Contributors"), QMessageBox::AcceptRole);
        secondButton->setIcon(QIcon(":icons/user_suit.png"));
        secondButton->setIconSize(QSize(16, 16));
        secondButton->setMinimumWidth(120);
        secondButton->disconnect();
        connect(secondButton, SIGNAL(clicked()), this, SLOT(showAboutContributors()));

        QPushButton *thirdButton = addButton(tr("About Qt4"), QMessageBox::AcceptRole);
        thirdButton->setIcon(QIcon(":/images/Qt.svg"));
        thirdButton->setIconSize(QSize(16, 16));
        thirdButton->setMinimumWidth(120);
        thirdButton->disconnect();
        connect(thirdButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));

        QPushButton *fourthButton = addButton(tr("Discard"), QMessageBox::AcceptRole);
        fourthButton->setIcon(QIcon(":/icons/cross.png"));
        fourthButton->setIconSize(QSize(16, 16));
        fourthButton->setMinimumWidth(90);

        QPixmap disque(":/images/Disque.png");
        QRect screenGeometry = QApplication::desktop()->availableGeometry();
        m_disque = new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
        m_disque->installEventFilter(this);
        m_disque->setStyleSheet("background:transparent;");
        m_disque->setAttribute(Qt::WA_TranslucentBackground);
        m_disque->setGeometry(qrand() % (screenGeometry.width() - disque.width()), qrand() % (screenGeometry.height() - disque.height()), disque.width(), disque.height());
        m_disque->setPixmap(disque);
        m_disque->setWindowOpacity(0.01);
        m_disque->show();
        m_disqueFlags[0] = (qrand() > (RAND_MAX/2));
        m_disqueFlags[1] = (qrand() > (RAND_MAX/2));
        m_disqueTimer = new QTimer;
        connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque()));
        m_disqueTimer->setInterval(10);
        m_disqueTimer->start();
    }

    m_firstShow = firstStart;
}