Merge pull request #1611 from waddlesplash/dolphin-qt

DolphinQt: various cleanup & fixes.
This commit is contained in:
Ryan Houdek 2014-12-07 01:11:17 -06:00
commit 9897f7675e
9 changed files with 54 additions and 61 deletions

View File

@ -225,9 +225,9 @@ QString GameFile::CreateCacheFilename()
// Filename.extension_HashOfFolderPath_Size.cache
// Append hash to prevent ISO name-clashing in different folders.
filename.append(StringFromFormat("%s_%x_%lx.qcache",
filename.append(StringFromFormat("%s_%x_%llx.qcache",
extension.c_str(), HashFletcher((const u8*)pathname.c_str(), pathname.size()),
File::GetSize(m_file_name.toStdString())));
(unsigned long long)File::GetSize(m_file_name.toStdString())));
QString fullname = QString::fromStdString(File::GetUserPath(D_CACHE_IDX));
fullname += QString::fromStdString(filename);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>256</width>
<height>192</height>
<width>254</width>
<height>190</height>
</rect>
</property>
<property name="isWrapping" stdset="0">
@ -16,6 +16,9 @@
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
</widget>
<resources/>
<connections/>

View File

@ -114,6 +114,7 @@ void DGameTree::AddGame(GameFile* item)
i->setText(COL_DESCRIPTION, item->GetDescription());
i->setIcon(COL_REGION, QIcon(Resources::GetRegionPixmap(item->GetCountry())));
i->setText(COL_SIZE, NiceSizeFormat(item->GetFileSize()));
i->setIcon(COL_STATE, QIcon(Resources::GetRatingPixmap(item->GetEmuState())));
if (item->IsCompressed())
{
for (int col = 0; col < columnCount(); col++)

View File

@ -261,16 +261,6 @@ void DMainWindow::OnCoreStateChanged(Core::EState state)
m_game_tracker->setEnabled(is_not_initialized);
}
bool DMainWindow::RenderWidgetHasFocus()
{
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
return isActiveWindow();
else if (m_render_widget != nullptr)
return m_render_widget->isActiveWindow();
else
return false;
}
// Update all the icons used in DMainWindow with fresh ones from
// "Resources". Call this function after changing the icon theme.
void DMainWindow::UpdateIcons()

View File

@ -27,7 +27,7 @@ public:
~DMainWindow();
// DRenderWidget
bool RenderWidgetHasFocus();
bool RenderWidgetHasFocus() const { return m_render_widget->isActiveWindow(); }
DRenderWidget* GetRenderWidget() { return m_render_widget.get(); }
signals:
@ -65,7 +65,7 @@ private:
QString ShowFileDialog();
void DoStartPause();
std::unique_ptr<DRenderWidget> m_render_widget; // TODO: just create this once and reuse it
std::unique_ptr<DRenderWidget> m_render_widget;
bool m_isStopping = false;
};

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>992</width>
<height>592</height>
<width>990</width>
<height>590</height>
</rect>
</property>
<property name="windowTitle">
@ -31,8 +31,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>992</width>
<height>21</height>
<width>990</width>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="mnuFile">
@ -60,16 +60,16 @@
<property name="title">
<string>&amp;View</string>
</property>
<widget class="QMenu" name="mnuGameListStyle">
<widget class="QMenu" name="mnuListStyle">
<property name="title">
<string>Gamelist view style</string>
<string>&amp;List style</string>
</property>
<addaction name="actionListView"/>
<addaction name="actionTreeView"/>
<addaction name="actionGridView"/>
<addaction name="actionIconView"/>
</widget>
<addaction name="mnuGameListStyle"/>
<addaction name="mnuListStyle"/>
</widget>
<widget class="QMenu" name="mnuHelp">
<property name="title">
@ -161,7 +161,7 @@
</action>
<action name="actionAboutQt">
<property name="text">
<string>About Qt</string>
<string>About &amp;Qt</string>
</property>
<property name="menuRole">
<enum>QAction::AboutQtRole</enum>
@ -172,7 +172,7 @@
<bool>true</bool>
</property>
<property name="text">
<string>List view</string>
<string>&amp;List view</string>
</property>
</action>
<action name="actionTreeView">
@ -180,7 +180,7 @@
<bool>true</bool>
</property>
<property name="text">
<string>Tree view</string>
<string>&amp;Tree view</string>
</property>
</action>
<action name="actionGridView">
@ -188,7 +188,7 @@
<bool>true</bool>
</property>
<property name="text">
<string>Grid view</string>
<string>&amp;Grid view</string>
</property>
</action>
<action name="actionIconView">
@ -196,7 +196,7 @@
<bool>true</bool>
</property>
<property name="text">
<string>Icon view</string>
<string>&amp;Icon view</string>
</property>
</action>
</widget>

View File

@ -27,14 +27,14 @@ DSystemInfo::DSystemInfo(QWidget* parent_widget) :
UpdateSystemInfo();
QPushButton* btn = m_ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
connect(btn, SIGNAL(pressed()), this, SLOT(btnCopy_pressed()));
connect(btn, SIGNAL(pressed()), this, SLOT(CopyPressed()));
}
DSystemInfo::~DSystemInfo()
{
}
void DSystemInfo::btnCopy_pressed()
void DSystemInfo::CopyPressed()
{
QClipboard* clipboard = QApplication::clipboard();
clipboard->setText(m_ui->txtSysInfo->toPlainText());
@ -75,8 +75,6 @@ QString DSystemInfo::GetOS() const
#elif defined(Q_OS_MAC)
ret += SL("Mac OS X ");
switch (QSysInfo::MacintoshVersion) {
case QSysInfo::MV_10_7: ret += SL("10.7"); break;
case QSysInfo::MV_10_8: ret += SL("10.8"); break;
case QSysInfo::MV_10_9: ret += SL("10.9"); break;
default: ret += SL("(unknown)"); break;
}

View File

@ -21,7 +21,7 @@ public:
~DSystemInfo();
private slots:
void btnCopy_pressed();
void CopyPressed();
private:
std::unique_ptr<Ui::DSystemInfo> m_ui;

View File

@ -16,48 +16,48 @@ QVector<QPixmap> Resources::m_regions;
QVector<QPixmap> Resources::m_ratings;
QVector<QPixmap> Resources::m_pixmaps;
// Wrapper for GetImageFilename() so you don't have to to call it directly
#define GIFN(file) GetImageFilename(SL(file), dir)
void Resources::Init()
{
QString dir = QString::fromStdString(File::GetSysDirectory() + "Resources/");
m_regions.resize(DiscIO::IVolume::NUMBER_OF_COUNTRIES);
m_regions[DiscIO::IVolume::COUNTRY_JAPAN].load(dir + SL("Flag_Japan.png"));
m_regions[DiscIO::IVolume::COUNTRY_EUROPE].load(dir + SL("Flag_Europe.png"));
m_regions[DiscIO::IVolume::COUNTRY_USA].load(dir + SL("Flag_USA.png"));
m_regions[DiscIO::IVolume::COUNTRY_JAPAN].load(GIFN("Flag_Japan"));
m_regions[DiscIO::IVolume::COUNTRY_EUROPE].load(GIFN("Flag_Europe"));
m_regions[DiscIO::IVolume::COUNTRY_USA].load(GIFN("Flag_USA"));
m_regions[DiscIO::IVolume::COUNTRY_AUSTRALIA].load(dir + SL("Flag_Australia.png"));
m_regions[DiscIO::IVolume::COUNTRY_FRANCE].load(dir + SL("Flag_France.png"));
m_regions[DiscIO::IVolume::COUNTRY_GERMANY].load(dir + SL("Flag_Germany.png"));
m_regions[DiscIO::IVolume::COUNTRY_INTERNATIONAL].load(dir + SL("Flag_Europe.png")); // Uses European flag as a placeholder
m_regions[DiscIO::IVolume::COUNTRY_ITALY].load(dir + SL("Flag_Italy.png"));
m_regions[DiscIO::IVolume::COUNTRY_KOREA].load(dir + SL("Flag_Korea.png"));
m_regions[DiscIO::IVolume::COUNTRY_NETHERLANDS].load(dir + SL("Flag_Netherlands.png"));
m_regions[DiscIO::IVolume::COUNTRY_RUSSIA].load(dir + SL("Flag_Russia.png"));
m_regions[DiscIO::IVolume::COUNTRY_SPAIN].load(dir + SL("Flag_Spain.png"));
m_regions[DiscIO::IVolume::COUNTRY_TAIWAN].load(dir + SL("Flag_Taiwan.png"));
m_regions[DiscIO::IVolume::COUNTRY_UNKNOWN].load(dir + SL("Flag_Unknown.png"));
m_regions[DiscIO::IVolume::COUNTRY_AUSTRALIA].load(GIFN("Flag_Australia"));
m_regions[DiscIO::IVolume::COUNTRY_FRANCE].load(GIFN("Flag_France"));
m_regions[DiscIO::IVolume::COUNTRY_GERMANY].load(GIFN("Flag_Germany"));
m_regions[DiscIO::IVolume::COUNTRY_INTERNATIONAL].load(GIFN("Flag_Europe")); // Uses European flag as a placeholder
m_regions[DiscIO::IVolume::COUNTRY_ITALY].load(GIFN("Flag_Italy"));
m_regions[DiscIO::IVolume::COUNTRY_KOREA].load(GIFN("Flag_Korea"));
m_regions[DiscIO::IVolume::COUNTRY_NETHERLANDS].load(GIFN("Flag_Netherlands"));
m_regions[DiscIO::IVolume::COUNTRY_RUSSIA].load(GIFN("Flag_Russia"));
m_regions[DiscIO::IVolume::COUNTRY_SPAIN].load(GIFN("Flag_Spain"));
m_regions[DiscIO::IVolume::COUNTRY_TAIWAN].load(GIFN("Flag_Taiwan"));
m_regions[DiscIO::IVolume::COUNTRY_UNKNOWN].load(GIFN("Flag_Unknown"));
m_platforms.resize(3);
m_platforms[0].load(dir + SL("Platform_Gamecube.png"));
m_platforms[1].load(dir + SL("Platform_Wii.png"));
m_platforms[2].load(dir + SL("Platform_Wad.png"));
m_platforms[0].load(GIFN("Platform_Gamecube"));
m_platforms[1].load(GIFN("Platform_Wii"));
m_platforms[2].load(GIFN("Platform_Wad"));
m_ratings.resize(6);
m_ratings[0].load(dir + SL("rating0.png"));
m_ratings[1].load(dir + SL("rating1.png"));
m_ratings[2].load(dir + SL("rating2.png"));
m_ratings[3].load(dir + SL("rating3.png"));
m_ratings[4].load(dir + SL("rating4.png"));
m_ratings[5].load(dir + SL("rating5.png"));
m_ratings[0].load(GIFN("rating0"));
m_ratings[1].load(GIFN("rating1"));
m_ratings[2].load(GIFN("rating2"));
m_ratings[3].load(GIFN("rating3"));
m_ratings[4].load(GIFN("rating4"));
m_ratings[5].load(GIFN("rating5"));
m_pixmaps.resize(NUM_ICONS);
m_pixmaps[DOLPHIN_LOGO].load(dir + SL("Dolphin.png"));
m_pixmaps[DOLPHIN_LOGO].load(GIFN("Dolphin"));
UpdatePixmaps();
}
// Wrapper for GetImageFilename() so you don't have to to call it directly
#define GIFN(file) GetImageFilename(SL(file), dir)
void Resources::UpdatePixmaps()
{
QString dir = QString::fromStdString(File::GetThemeDir(SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name));
@ -84,7 +84,8 @@ QString Resources::GetImageFilename(QString name, QString dir)
{
if (qApp->devicePixelRatio() >= 2)
{
QString fileName = name.prepend(dir).append(SL("@2x.png"));
QString fileName = name;
fileName.prepend(dir).append(SL("@2x.png"));
if (QFile::exists(fileName))
return fileName;
}