Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legacy OS X build changes #1537

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions macos/CFBundleDocumentTypes.json

This file was deleted.

53 changes: 53 additions & 0 deletions macos/ExtraInfo.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>h2song</string>
</array>
<key>CFBundleTypeName</key>
<string>Hydrogen song</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>h2drumkit</string>
</array>
<key>CFBundleTypeName</key>
<string>Hydrogen drumkit</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>h2playlist</string>
</array>
<key>CFBundleTypeName</key>
<string>Hydrogen playlist</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>h2pattern</string>
</array>
<key>CFBundleTypeName</key>
<string>Hydrogen pattern</string>
</dict>
</array>

<key>NSHighResolutionCapable</key>
<true/>

<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
20 changes: 3 additions & 17 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,10 @@ if(APPLE)
add_custom_command(
TARGET hydrogen
POST_BUILD
COMMAND plutil -replace NSPrincipalClass -string NSApplication hydrogen.app/Contents/Info.plist
COMMAND /usr/libexec/PlistBuddy
-c "merge ${CMAKE_SOURCE_DIR}/macos/ExtraInfo.plist"
hydrogen.app/Contents/Info.plist
)
add_custom_command(
TARGET hydrogen
POST_BUILD
COMMAND plutil -replace NSHighResolutionCapable -bool true hydrogen.app/Contents/Info.plist
)
add_custom_command(
TARGET hydrogen
POST_BUILD
COMMAND
plutil -extract CFBundleDocumentTypes json
-o /dev/null
hydrogen.app/Contents/Info.plist >/dev/null
|| plutil -insert CFBundleDocumentTypes
-json
\"` cat ${CMAKE_SOURCE_DIR}/macos/CFBundleDocumentTypes.json `\"
hydrogen.app/Contents/Info.plist )

ADD_FILE_DEPENDENCIES(hydrogen ${CMAKE_SOURCE_DIR}/macos/CFBundleDocumentTypes.json)

Expand Down
4 changes: 2 additions & 2 deletions src/gui/src/HydrogenApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ bool HydrogenApp::openSong( QString sFilename) {
// In case the user did open a hidden file, the baseName()
// will be an empty string.
QString sBaseName( fileInfo.completeBaseName() );
if ( sBaseName.front() == "." ) {
if ( sBaseName.startsWith( "." ) ) {
sBaseName.remove( 0, 1 );
}

Expand Down Expand Up @@ -473,7 +473,7 @@ bool HydrogenApp::recoverEmptySong() {
// In case the user did open a hidden file, the baseName()
// will be an empty string.
QString sBaseName( fileInfo.completeBaseName() );
if ( sBaseName.front() == "." ) {
if ( sBaseName.startsWith( "." ) ) {
sBaseName.remove( 0, 1 );
}

Expand Down
4 changes: 2 additions & 2 deletions src/gui/src/MainForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ void MainForm::action_file_new()
// autosave file in order to start fresh.
QFileInfo fileInfo( Filesystem::empty_song_path() );
QString sBaseName( fileInfo.completeBaseName() );
if ( sBaseName.front() == "." ) {
if ( sBaseName.startsWith( "." ) ) {
sBaseName.remove( 0, 1 );
}
QFileInfo autoSaveFile( QString( "%1/.%2.autosave.h2song" )
Expand Down Expand Up @@ -2070,7 +2070,7 @@ QString MainForm::getAutoSaveFilename()
// In case the user did open a hidden file, the baseName()
// will be an empty string.
QString sBaseName( fileInfo.completeBaseName() );
if ( sBaseName.front() == "." ) {
if ( sBaseName.startsWith( "." ) ) {
sBaseName.remove( 0, 1 );
}

Expand Down
6 changes: 3 additions & 3 deletions src/gui/src/Widgets/LCDSpinBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void LCDSpinBox::keyPressEvent( QKeyEvent *ev ) {
double LCDSpinBox::nextValueInPatternSizeDenominator( bool bUp, bool bAccelerated ) {

// Determine the next value.
std::vector vChoices{ 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 192 };
std::vector< int > vChoices{ 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 192 };

double fNextValue = 1.0;
double fOffset = 0.0;
Expand Down Expand Up @@ -226,8 +226,8 @@ QString LCDSpinBox::textFromValue( double fValue ) const {

QValidator::State LCDSpinBox::validate( QString &text, int &pos ) const {
if ( m_kind == Kind::PatternSizeDenominator ) {
std::vector vChoices{ "1", "2", "3", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "192" };
std::vector vCandidates1{ "1", "2", "3", "4", "6", "9" };
std::vector< QString > vChoices{ "1", "2", "3", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "192" };
std::vector< QString > vCandidates1{ "1", "2", "3", "4", "6", "9" };
QString sCandidate2( "19" );
bool bContained = false;
bool bIsCandidate = false;
Expand Down