Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
b68cf513
Commit
b68cf513
authored
Apr 12, 2015
by
Matt Lowe
Browse files
Added menu item to open custom image folder
Needs to be tested on mac
parent
1e06a971
Changes
2
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/tab_deck_editor.cpp
View file @
b68cf513
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include
<QApplication>
#include
<QApplication>
#include
<QClipboard>
#include
<QClipboard>
#include
<QTextStream>
#include
<QTextStream>
#include
<QProcessEnvironment>
#include
"tab_deck_editor.h"
#include
"tab_deck_editor.h"
#include
"window_sets.h"
#include
"window_sets.h"
#include
"carddatabase.h"
#include
"carddatabase.h"
...
@@ -228,6 +229,8 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
...
@@ -228,6 +229,8 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
connect
(
aAnalyzeDeck
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actAnalyzeDeck
()));
connect
(
aAnalyzeDeck
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actAnalyzeDeck
()));
aClose
=
new
QAction
(
QString
(),
this
);
aClose
=
new
QAction
(
QString
(),
this
);
connect
(
aClose
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
closeRequest
()));
connect
(
aClose
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
closeRequest
()));
aOpenCustomFolder
=
new
QAction
(
QString
(),
this
);
connect
(
aOpenCustomFolder
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actOpenCustomFolder
()));
aEditSets
=
new
QAction
(
QString
(),
this
);
aEditSets
=
new
QAction
(
QString
(),
this
);
connect
(
aEditSets
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actEditSets
()));
connect
(
aEditSets
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actEditSets
()));
...
@@ -256,6 +259,10 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
...
@@ -256,6 +259,10 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
dbMenu
->
addSeparator
();
dbMenu
->
addSeparator
();
dbMenu
->
addAction
(
aClearSearch
);
dbMenu
->
addAction
(
aClearSearch
);
dbMenu
->
addAction
(
aCardTextOnly
);
dbMenu
->
addAction
(
aCardTextOnly
);
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
dbMenu
->
addSeparator
();
dbMenu
->
addAction
(
aOpenCustomFolder
);
#endif
addTabMenu
(
dbMenu
);
addTabMenu
(
dbMenu
);
aAddCard
=
new
QAction
(
QString
(),
this
);
aAddCard
=
new
QAction
(
QString
(),
this
);
...
@@ -311,6 +318,7 @@ void TabDeckEditor::retranslateUi()
...
@@ -311,6 +318,7 @@ void TabDeckEditor::retranslateUi()
aSaveDeckToClipboard
->
setText
(
tr
(
"Save deck to clip&board"
));
aSaveDeckToClipboard
->
setText
(
tr
(
"Save deck to clip&board"
));
aPrintDeck
->
setText
(
tr
(
"&Print deck..."
));
aPrintDeck
->
setText
(
tr
(
"&Print deck..."
));
aAnalyzeDeck
->
setText
(
tr
(
"&Analyze deck on deckstats.net"
));
aAnalyzeDeck
->
setText
(
tr
(
"&Analyze deck on deckstats.net"
));
aOpenCustomFolder
->
setText
(
tr
(
"Open custom image folder"
));
aClose
->
setText
(
tr
(
"&Close"
));
aClose
->
setText
(
tr
(
"&Close"
));
aClose
->
setShortcut
(
tr
(
"Ctrl+Q"
));
aClose
->
setShortcut
(
tr
(
"Ctrl+Q"
));
...
@@ -523,6 +531,28 @@ void TabDeckEditor::actAnalyzeDeck()
...
@@ -523,6 +531,28 @@ void TabDeckEditor::actAnalyzeDeck()
interface
->
analyzeDeck
(
deckModel
->
getDeckList
());
interface
->
analyzeDeck
(
deckModel
->
getDeckList
());
}
}
void
TabDeckEditor
::
actOpenCustomFolder
()
{
#if defined(Q_OS_MAC)
QStringList
scriptArgs
;
scriptArgs
<<
QLatin1String
(
"-e"
);
scriptArgs
<<
QString
::
fromLatin1
(
"tell application
\"
Finder
\"
to open POSIX file
\"
%1
\"
"
).
arg
(
settingsCache
->
getPicsPath
()
+
"/custom/"
);
scriptArgs
<<
QLatin1String
(
"-e"
);
scriptArgs
<<
QLatin1String
(
"tell application
\"
Finder
\"
to activate"
);
QProcess
::
execute
(
"/usr/bin/osascript"
,
scriptArgs
);
#endif
#if defined(Q_OS_WIN)
QStringList
args
;
QString
pathToFolder
=
settingsCache
->
getPicsPath
().
append
(
"/custom"
);
args
<<
QDir
::
toNativeSeparators
(
pathToFolder
);
QProcess
::
startDetached
(
"explorer"
,
args
);
#endif
}
void
TabDeckEditor
::
actEditSets
()
void
TabDeckEditor
::
actEditSets
()
{
{
WndSets
*
w
=
new
WndSets
;
WndSets
*
w
=
new
WndSets
;
...
...
cockatrice/src/tab_deck_editor.h
View file @
b68cf513
...
@@ -20,55 +20,56 @@ class FilterTreeModel;
...
@@ -20,55 +20,56 @@ class FilterTreeModel;
class
CardInfo
;
class
CardInfo
;
class
SearchLineEdit
:
public
QLineEdit
{
class
SearchLineEdit
:
public
QLineEdit
{
private:
private:
QTreeView
*
treeView
;
QTreeView
*
treeView
;
protected:
protected:
void
keyPressEvent
(
QKeyEvent
*
event
);
void
keyPressEvent
(
QKeyEvent
*
event
);
public:
public:
SearchLineEdit
()
:
QLineEdit
(),
treeView
(
0
)
{
}
SearchLineEdit
()
:
QLineEdit
(),
treeView
(
0
)
{
}
void
setTreeView
(
QTreeView
*
_treeView
)
{
treeView
=
_treeView
;
}
void
setTreeView
(
QTreeView
*
_treeView
)
{
treeView
=
_treeView
;
}
};
};
class
TabDeckEditor
:
public
Tab
{
class
TabDeckEditor
:
public
Tab
{
Q_OBJECT
Q_OBJECT
private
slots
:
private
slots
:
void
updateName
(
const
QString
&
name
);
void
updateName
(
const
QString
&
name
);
void
updateComments
();
void
updateComments
();
void
updateHash
();
void
updateHash
();
void
updateCardInfoLeft
(
const
QModelIndex
&
current
,
const
QModelIndex
&
previous
);
void
updateCardInfoLeft
(
const
QModelIndex
&
current
,
const
QModelIndex
&
previous
);
void
updateCardInfoRight
(
const
QModelIndex
&
current
,
const
QModelIndex
&
previous
);
void
updateCardInfoRight
(
const
QModelIndex
&
current
,
const
QModelIndex
&
previous
);
void
updateSearch
(
const
QString
&
search
);
void
updateSearch
(
const
QString
&
search
);
void
actNewDeck
();
void
actNewDeck
();
void
actLoadDeck
();
void
actLoadDeck
();
bool
actSaveDeck
();
bool
actSaveDeck
();
bool
actSaveDeckAs
();
bool
actSaveDeckAs
();
void
actLoadDeckFromClipboard
();
void
actLoadDeckFromClipboard
();
void
actSaveDeckToClipboard
();
void
actSaveDeckToClipboard
();
void
actPrintDeck
();
void
actPrintDeck
();
void
actAnalyzeDeck
();
void
actAnalyzeDeck
();
void
actOpenCustomFolder
();
void
actEditSets
();
void
actEditTokens
();
void
actEditSets
();
void
actEditTokens
();
void
actClearSearch
();
void
actClearSearch
();
void
actSwapCard
();
void
actAddCard
();
void
actSwapCard
();
void
actAddCardToSideboard
();
void
actAddCard
();
void
actRemoveCard
();
void
actAddCardToSideboard
();
void
actIncrement
();
void
actRemoveCard
();
void
actDecrement
();
void
actIncrement
();
void
actDecrementCard
();
void
actDecrement
();
void
actDecrementCardFromSideboard
();
void
actDecrementCard
();
void
actDecrementCardFromSideboard
();
//void actUpdatePrices();
//void actUpdatePrices();
void
finishedUpdatingPrices
();
void
saveDeckRemoteFinished
(
const
Response
&
r
);
void
finishedUpdatingPrices
();
void
filterViewCustomContextMenu
(
const
QPoint
&
point
);
void
saveDeckRemoteFinished
(
const
Response
&
r
);
void
filterRemove
(
QAction
*
action
);
void
filterViewCustomContextMenu
(
const
QPoint
&
point
);
void
setPriceTagFeatureEnabled
(
int
enabled
);
void
filterRemove
(
QAction
*
action
);
void
setPriceTagFeatureEnabled
(
int
enabled
);
private:
private:
CardInfo
*
currentCardInfo
()
const
;
CardInfo
*
currentCardInfo
()
const
;
void
addCardHelper
(
QString
zoneName
);
void
addCardHelper
(
QString
zoneName
);
...
@@ -97,10 +98,10 @@ private:
...
@@ -97,10 +98,10 @@ private:
QTreeView
*
filterView
;
QTreeView
*
filterView
;
QMenu
*
deckMenu
,
*
dbMenu
;
QMenu
*
deckMenu
,
*
dbMenu
;
QAction
*
aNewDeck
,
*
aLoadDeck
,
*
aSaveDeck
,
*
aSaveDeckAs
,
*
aLoadDeckFromClipboard
,
*
aSaveDeckToClipboard
,
*
aPrintDeck
,
*
aAnalyzeDeck
,
*
aClose
;
QAction
*
aNewDeck
,
*
aLoadDeck
,
*
aSaveDeck
,
*
aSaveDeckAs
,
*
aLoadDeckFromClipboard
,
*
aSaveDeckToClipboard
,
*
aPrintDeck
,
*
aAnalyzeDeck
,
*
aClose
,
*
aOpenCustomFolder
;
QAction
*
aEditSets
,
*
aEditTokens
,
*
aClearSearch
,
*
aCardTextOnly
;
QAction
*
aEditSets
,
*
aEditTokens
,
*
aClearSearch
,
*
aCardTextOnly
;
QAction
*
aAddCard
,
*
aAddCardToSideboard
,
*
aRemoveCard
,
*
aIncrement
,
*
aDecrement
;
// *aUpdatePrices;
QAction
*
aAddCard
,
*
aAddCardToSideboard
,
*
aRemoveCard
,
*
aIncrement
,
*
aDecrement
;
// *aUpdatePrices;
bool
modified
;
bool
modified
;
public:
public:
TabDeckEditor
(
TabSupervisor
*
_tabSupervisor
,
QWidget
*
parent
=
0
);
TabDeckEditor
(
TabSupervisor
*
_tabSupervisor
,
QWidget
*
parent
=
0
);
...
@@ -110,10 +111,10 @@ public:
...
@@ -110,10 +111,10 @@ public:
void
setDeck
(
DeckLoader
*
_deckLoader
);
void
setDeck
(
DeckLoader
*
_deckLoader
);
void
setModified
(
bool
_windowModified
);
void
setModified
(
bool
_windowModified
);
bool
confirmClose
();
bool
confirmClose
();
public
slots
:
public
slots
:
void
closeRequest
();
void
closeRequest
();
signals:
signals:
void
deckEditorClosing
(
TabDeckEditor
*
tab
);
void
deckEditorClosing
(
TabDeckEditor
*
tab
);
};
};
#endif
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment