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"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="dropBoxLabel"> <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"> <property name="lineWidth">
<number>0</number> <number>0</number>
</property> </property>
@ -48,6 +51,8 @@
<include location="../res/Icons.qrc"/> <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"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

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

View File

@ -40,7 +40,7 @@
#include <Windows.h> #include <Windows.h>
//Helper macros //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 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))) #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 += 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 += "Released under the terms of the GNU Leser General Public License.<br>";
moreAboutText += LINK("http://lame.sourceforge.net/"); 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 += 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 += "<br>Completely open and patent-free audio encoding technology.<br>";
moreAboutText += LINK("http://www.vorbis.com/"); 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 += 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 += "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 += "<i>Available from vendor web-site as free download:</i><br>";
moreAboutText += LINK(neroAacUrl); 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 += 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 += "Open and patent-free lossless audio compression technology.<br>";
moreAboutText += LINK("http://flac.sourceforge.net/"); 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 += 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 += "Released under the terms of the GNU Leser General Public License.<br>";
moreAboutText += LINK("http://www.ac3filter.net/projects/tools"); 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 += 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 += "Released under the terms of the GNU Leser General Public License.<br>";
moreAboutText += LINK("http://mediainfo.sourceforge.net/"); 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 += 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 += "Released under the terms of the GNU Leser General Public License.<br>";
moreAboutText += LINK("http://sox.sourceforge.net/"); 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 += 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 += "Released under the terms of the GNU Leser General Public License.<br>";
moreAboutText += LINK("http://www.gnupg.org/"); 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 += "<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>"; moreAboutText += "<nobr>By Mark James, released under the Creative Commons 'by' License.</nobr><br>";

View File

@ -28,6 +28,8 @@
#include <QMovie> #include <QMovie>
#include <QKeyEvent> #include <QKeyEvent>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QToolTip>
#include <QTimer>
#include <Windows.h> #include <Windows.h>
#define EPS (1.0E-5) #define EPS (1.0E-5)
@ -43,6 +45,7 @@ DropBox::DropBox(QWidget *parent, QAbstractItemModel *model, SettingsModel *sett
m_counterLabel(this), m_counterLabel(this),
m_model(model), m_model(model),
m_settings(settings), m_settings(settings),
m_moving(false),
m_firstShow(true) m_firstShow(true)
{ {
//Init the dialog, from the .ui file //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_x = screenGeometry.width() - frameGeometry().width();
int max_y = screenGeometry.height() - frameGeometry().height(); int max_y = screenGeometry.height() - frameGeometry().height();
move(max_x, max_y); move(max_x, max_y);
QTimer::singleShot(333, this, SLOT(showToolTip()));
} }
m_moving = false;
} }
void DropBox::keyPressEvent(QKeyEvent *event) void DropBox::keyPressEvent(QKeyEvent *event)
@ -120,6 +126,12 @@ void DropBox::closeEvent(QCloseEvent *event)
void DropBox::mousePressEvent(QMouseEvent *event) void DropBox::mousePressEvent(QMouseEvent *event)
{ {
if(m_moving)
{
event->ignore();
return;
}
if(event->button() == Qt::RightButton) if(event->button() == Qt::RightButton)
{ {
hide(); hide();
@ -128,17 +140,28 @@ void DropBox::mousePressEvent(QMouseEvent *event)
} }
QApplication::setOverrideCursor(Qt::SizeAllCursor); QApplication::setOverrideCursor(Qt::SizeAllCursor);
m_moving = true;
m_windowReferencePoint = this->pos(); m_windowReferencePoint = this->pos();
m_mouseReferencePoint = event->globalPos(); m_mouseReferencePoint = event->globalPos();
} }
void DropBox::mouseReleaseEvent(QMouseEvent *event) void DropBox::mouseReleaseEvent(QMouseEvent *event)
{ {
if(m_moving && event->button() != Qt::RightButton)
{
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
m_moving = false;
}
} }
void DropBox::mouseMoveEvent(QMouseEvent *event) void DropBox::mouseMoveEvent(QMouseEvent *event)
{ {
if(!m_moving)
{
return;
}
static const int magnetic = 22;
QRect screenGeometry = QApplication::desktop()->availableGeometry(); QRect screenGeometry = QApplication::desktop()->availableGeometry();
int delta_x = m_mouseReferencePoint.x() - event->globalX(); 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_x = min(max_x, max(0, m_windowReferencePoint.x() - delta_x));
int new_y = min(max_y, max(0, m_windowReferencePoint.y() - delta_y)); 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); 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; QLabel m_counterLabel;
QAbstractItemModel *m_model; QAbstractItemModel *m_model;
SettingsModel *m_settings; SettingsModel *m_settings;
bool m_moving;
bool m_firstShow; bool m_firstShow;
protected: protected:
@ -62,4 +63,5 @@ protected:
public slots: public slots:
void modelChanged(void); 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 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_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 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) #define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(URL)
//Helper class //Helper class
@ -380,11 +381,13 @@ void MainWindow::showEvent(QShowEvent *event)
m_firstTimeShown = false; m_firstTimeShown = false;
QTimer::singleShot(0, this, SLOT(windowShown())); QTimer::singleShot(0, this, SLOT(windowShown()));
} }
else
{
if(m_settings->dropBoxWidgetEnabled()) if(m_settings->dropBoxWidgetEnabled())
{ {
m_dropBox->setVisible(true); m_dropBox->setVisible(true);
} }
}
} }
void MainWindow::dragEnterEvent(QDragEnterEvent *event) void MainWindow::dragEnterEvent(QDragEnterEvent *event)
@ -601,6 +604,12 @@ void MainWindow::windowShown(void)
{ {
m_delayedFileTimer->start(5000); 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(); m_dropBox->show();
} }
FLASHWINFO flashInfo; FLASH_WINDOW(m_dropBox);
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);
} }