Some DropBox improvements.

This commit is contained in:
LoRd_MuldeR 2010-12-22 22:59:00 +01:00
parent 6bd2859dfd
commit 7269e7fc9a
6 changed files with 79 additions and 24 deletions

View File

@ -25,6 +25,9 @@
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLabel" name="dropBoxLabel">
<property name="toolTip">
<string>&lt;b&gt;LameXP DropBox&lt;/b&gt;&lt;br&gt;&lt;nobr&gt;You can add files to LameXP via Drag&amp;amp;Drop here!&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;(Right-click to close to DropBox)&lt;/nobr&gt;</string>
</property>
<property name="lineWidth">
<number>0</number>
</property>
@ -48,6 +51,8 @@
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0
#define VER_LAMEXP_BUILD 179
#define VER_LAMEXP_BUILD 181
#define VER_LAMEXP_SUFFIX TechPreview
/*

View File

@ -40,7 +40,7 @@
#include <Windows.h>
//Helper macros
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(URL)
#define LINK(URL) QString("<a href=\"%1\">&#8627;%2</a>").arg(URL).arg(URL)
#define CONTRIBUTOR(LANG, CNTR, ICON) QString("<tr><td valign=\"middle\"><img src=\"%1\"></td><td>&nbsp;&nbsp;</td><td valign=\"middle\">%2</td><td>&nbsp;&nbsp;</td><td valign=\"middle\">%3</td></tr>").arg(ICON, LANG, CNTR);
#define VSTR(BASE,TOOL,FORMAT) QString(BASE).arg(lamexp_version2string(FORMAT, lamexp_tool_version(TOOL)))
@ -226,43 +226,43 @@ void AboutDialog::showMoreAbout(void)
moreAboutText += VSTR( "<li><b>LAME - OpenSource mp3 Encoder (%1)</b><br>", "lame.exe", "v?.?? a??");
moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
moreAboutText += LINK("http://lame.sourceforge.net/");
moreAboutText += "<br>";
moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
moreAboutText += VSTR("<li><b>OggEnc - Ogg Vorbis Encoder (%1)</b>", "oggenc2_i386.exe", "v?.??");
moreAboutText += "<br>Completely open and patent-free audio encoding technology.<br>";
moreAboutText += LINK("http://www.vorbis.com/");
moreAboutText += "<br>";
moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
moreAboutText += VSTR("<li><b>Nero AAC reference MPEG-4 Encoder (%1)</b><br>", "neroAacEnc.exe", "v?.?.?.?");
moreAboutText += "Freeware state-of-the-art HE-AAC encoder with 2-Pass support.<br>";
moreAboutText += "<i>Available from vendor web-site as free download:</i><br>";
moreAboutText += LINK(neroAacUrl);
moreAboutText += "<br>";
moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
moreAboutText += VSTR("<li><b>FLAC - Free Lossless Audio Codec (%1)</b><br>", "flac.exe", "v?.?.?");
moreAboutText += "Open and patent-free lossless audio compression technology.<br>";
moreAboutText += LINK("http://flac.sourceforge.net/");
moreAboutText += "<br>";
moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
moreAboutText += VSTR("<li><b>AC3Filter Tools - AC3/DTS Decoder (%1)</b><br>", "valdec.exe", "v?.??");
moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
moreAboutText += LINK("http://www.ac3filter.net/projects/tools");
moreAboutText += "<br>";
moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
moreAboutText += VSTR("<li><b>MediaInfo - Media File Analysis Tool (%1)</b><br>", "mediainfo_i386.exe", "v?.?.?");
moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
moreAboutText += LINK("http://mediainfo.sourceforge.net/");
moreAboutText += "<br>";
moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
moreAboutText += VSTR("<li><b>SoX - Sound eXchange (%1)</b><br>", "sox.exe", "v??.?.?");
moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
moreAboutText += LINK("http://sox.sourceforge.net/");
moreAboutText += "<br>";
moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
moreAboutText += VSTR("<li><b>GnuPG - The GNU Privacy Guard (%1)</b><br>", "gpgv.exe", "v?.?.??");
moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
moreAboutText += LINK("http://www.gnupg.org/");
moreAboutText += "<br>";
moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
moreAboutText += "<li><b>Silk Icons - Over 700 icons in PNG format (v1.3)</b><br>";
moreAboutText += "<nobr>By Mark James, released under the Creative Commons 'by' License.</nobr><br>";

View File

@ -28,6 +28,8 @@
#include <QMovie>
#include <QKeyEvent>
#include <QDesktopWidget>
#include <QToolTip>
#include <QTimer>
#include <Windows.h>
#define EPS (1.0E-5)
@ -43,6 +45,7 @@ DropBox::DropBox(QWidget *parent, QAbstractItemModel *model, SettingsModel *sett
m_counterLabel(this),
m_model(model),
m_settings(settings),
m_moving(false),
m_firstShow(true)
{
//Init the dialog, from the .ui file
@ -100,7 +103,10 @@ void DropBox::showEvent(QShowEvent *event)
int max_x = screenGeometry.width() - frameGeometry().width();
int max_y = screenGeometry.height() - frameGeometry().height();
move(max_x, max_y);
QTimer::singleShot(333, this, SLOT(showToolTip()));
}
m_moving = false;
}
void DropBox::keyPressEvent(QKeyEvent *event)
@ -120,6 +126,12 @@ void DropBox::closeEvent(QCloseEvent *event)
void DropBox::mousePressEvent(QMouseEvent *event)
{
if(m_moving)
{
event->ignore();
return;
}
if(event->button() == Qt::RightButton)
{
hide();
@ -128,17 +140,28 @@ void DropBox::mousePressEvent(QMouseEvent *event)
}
QApplication::setOverrideCursor(Qt::SizeAllCursor);
m_moving = true;
m_windowReferencePoint = this->pos();
m_mouseReferencePoint = event->globalPos();
}
void DropBox::mouseReleaseEvent(QMouseEvent *event)
{
if(m_moving && event->button() != Qt::RightButton)
{
QApplication::restoreOverrideCursor();
m_moving = false;
}
}
void DropBox::mouseMoveEvent(QMouseEvent *event)
{
if(!m_moving)
{
return;
}
static const int magnetic = 22;
QRect screenGeometry = QApplication::desktop()->availableGeometry();
int delta_x = m_mouseReferencePoint.x() - event->globalX();
@ -150,5 +173,28 @@ void DropBox::mouseMoveEvent(QMouseEvent *event)
int new_x = min(max_x, max(0, m_windowReferencePoint.x() - delta_x));
int new_y = min(max_y, max(0, m_windowReferencePoint.y() - delta_y));
if(new_x < magnetic)
{
new_x = 0;
}
else if(max_x - new_x < magnetic)
{
new_x = max_x;
}
if(new_y < magnetic)
{
new_y = 0;
}
else if(max_y - new_y < magnetic)
{
new_y = max_y;
}
move(new_x, new_y);
}
void DropBox::showToolTip(void)
{
QToolTip::showText(dropBoxLabel->mapToGlobal(dropBoxLabel->pos()), dropBoxLabel->toolTip());
}

View File

@ -49,6 +49,7 @@ private:
QLabel m_counterLabel;
QAbstractItemModel *m_model;
SettingsModel *m_settings;
bool m_moving;
bool m_firstShow;
protected:
@ -62,4 +63,5 @@ protected:
public slots:
void modelChanged(void);
void showToolTip(void);
};

View File

@ -67,6 +67,7 @@
#define ABORT_IF_BUSY if(m_banner->isVisible() || m_delayedFileTimer->isActive()) { MessageBeep(MB_ICONEXCLAMATION); return; }
#define SET_TEXT_COLOR(WIDGET,COLOR) { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, COLOR); WIDGET->setPalette(_palette); }
#define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); }
#define FLASH_WINDOW(WND) { FLASHWINFO flashInfo; memset(&flashInfo, 0, sizeof(FLASHWINFO)); flashInfo.cbSize = sizeof(FLASHWINFO); flashInfo.dwFlags = FLASHW_ALL; flashInfo.uCount = 12; flashInfo.dwTimeout = 125; flashInfo.hwnd = WND->winId(); FlashWindowEx(&flashInfo); }
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(URL)
//Helper class
@ -380,12 +381,14 @@ void MainWindow::showEvent(QShowEvent *event)
m_firstTimeShown = false;
QTimer::singleShot(0, this, SLOT(windowShown()));
}
else
{
if(m_settings->dropBoxWidgetEnabled())
{
m_dropBox->setVisible(true);
}
}
}
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
@ -601,6 +604,12 @@ void MainWindow::windowShown(void)
{
m_delayedFileTimer->start(5000);
}
//Make DropBox visible
if(m_settings->dropBoxWidgetEnabled())
{
m_dropBox->setVisible(true);
}
}
/*
@ -1645,12 +1654,5 @@ void MainWindow::showDropBoxWidgetActionTriggered(bool checked)
m_dropBox->show();
}
FLASHWINFO flashInfo;
memset(&flashInfo, 0, sizeof(FLASHWINFO));
flashInfo.cbSize = sizeof(FLASHWINFO);
flashInfo.dwFlags = FLASHW_ALL;
flashInfo.uCount = 12;
flashInfo.dwTimeout = 125;
flashInfo.hwnd = m_dropBox->winId();
FlashWindowEx(&flashInfo);
FLASH_WINDOW(m_dropBox);
}