forked from len0rd/rockbox
Theme Editor: Added recent docs/projects menus. Modified buildtargetdb.php to add a do-not-modify warning to the top of its output, and generated a new targetdb file with the warning in place
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27564 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e024198305
commit
e1e51f9994
5 changed files with 193 additions and 1 deletions
|
|
@ -21,6 +21,18 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
// Printing the do-not-modify warning
|
||||||
|
echo "# ----------------------------------------------------------- #\n";
|
||||||
|
echo "# ----------------------------------------------------------- #\n";
|
||||||
|
echo "# --- This file automatically generated, do not modify! --- #\n";
|
||||||
|
echo "# --- To add a target to the targetdb, add it to the --- #\n";
|
||||||
|
echo "# --- \$targets array in buildtargetdb.php and run that --- #\n";
|
||||||
|
echo "# --- script, ensuring that your current directory is --- #\n";
|
||||||
|
echo "# --- utils/themeeditor, and pipe the output into --- #\n";
|
||||||
|
echo "# --- utils/themeeditor/resources/targetdb --- #\n";
|
||||||
|
echo "# ----------------------------------------------------------- #\n";
|
||||||
|
echo "# ----------------------------------------------------------- #\n\n";
|
||||||
|
|
||||||
// This is the array of targets, with the target id as the key and the
|
// This is the array of targets, with the target id as the key and the
|
||||||
// plaintext name of the target as the value
|
// plaintext name of the target as the value
|
||||||
$targets = array( 'archosfmrecorder' => 'Archos FM Recorder',
|
$targets = array( 'archosfmrecorder' => 'Archos FM Recorder',
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
|
const int EditorWindow::numRecent = 5;
|
||||||
|
|
||||||
EditorWindow::EditorWindow(QWidget *parent) :
|
EditorWindow::EditorWindow(QWidget *parent) :
|
||||||
QMainWindow(parent), ui(new Ui::EditorWindow), parseTreeSelection(0)
|
QMainWindow(parent), ui(new Ui::EditorWindow), parseTreeSelection(0)
|
||||||
{
|
{
|
||||||
|
|
@ -56,6 +58,8 @@ EditorWindow::~EditorWindow()
|
||||||
delete project;
|
delete project;
|
||||||
delete deviceConfig;
|
delete deviceConfig;
|
||||||
delete deviceDock;
|
delete deviceDock;
|
||||||
|
delete timer;
|
||||||
|
delete timerDock;
|
||||||
|
|
||||||
RBFontCache::clearCache();
|
RBFontCache::clearCache();
|
||||||
RBTextCache::clearCache();
|
RBTextCache::clearCache();
|
||||||
|
|
@ -63,6 +67,8 @@ EditorWindow::~EditorWindow()
|
||||||
|
|
||||||
void EditorWindow::loadTabFromSkinFile(QString fileName)
|
void EditorWindow::loadTabFromSkinFile(QString fileName)
|
||||||
{
|
{
|
||||||
|
docToTop(fileName);
|
||||||
|
|
||||||
/* Checking to see if the file is already open */
|
/* Checking to see if the file is already open */
|
||||||
for(int i = 0; i < ui->editorTabs->count(); i++)
|
for(int i = 0; i < ui->editorTabs->count(); i++)
|
||||||
{
|
{
|
||||||
|
|
@ -114,6 +120,12 @@ void EditorWindow::loadSettings()
|
||||||
QSize size = settings.value("size").toSize();
|
QSize size = settings.value("size").toSize();
|
||||||
QPoint pos = settings.value("position").toPoint();
|
QPoint pos = settings.value("position").toPoint();
|
||||||
QByteArray state = settings.value("state").toByteArray();
|
QByteArray state = settings.value("state").toByteArray();
|
||||||
|
|
||||||
|
/* Recent docs/projects */
|
||||||
|
recentDocs = settings.value("recentDocs", QStringList()).toStringList();
|
||||||
|
recentProjects = settings.value("recentProjects",
|
||||||
|
QStringList()).toStringList();
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
if(!(size.isNull() || pos.isNull() || state.isNull()))
|
if(!(size.isNull() || pos.isNull() || state.isNull()))
|
||||||
|
|
@ -135,6 +147,11 @@ void EditorWindow::saveSettings()
|
||||||
settings.setValue("position", pos());
|
settings.setValue("position", pos());
|
||||||
settings.setValue("size", size());
|
settings.setValue("size", size());
|
||||||
settings.setValue("state", saveState());
|
settings.setValue("state", saveState());
|
||||||
|
|
||||||
|
/* Saving recent docs/projects */
|
||||||
|
settings.setValue("recentDocs", recentDocs);
|
||||||
|
settings.setValue("recentProjects", recentProjects);
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -245,6 +262,30 @@ void EditorWindow::setupMenus()
|
||||||
this, SLOT(paste()));
|
this, SLOT(paste()));
|
||||||
QObject::connect(ui->actionFind_Replace, SIGNAL(triggered()),
|
QObject::connect(ui->actionFind_Replace, SIGNAL(triggered()),
|
||||||
this, SLOT(findReplace()));
|
this, SLOT(findReplace()));
|
||||||
|
|
||||||
|
/* Adding the recent docs/projects menus */
|
||||||
|
for(int i = 0; i < numRecent; i++)
|
||||||
|
{
|
||||||
|
recentDocsMenu.append(new QAction(tr("Recent Doc"),
|
||||||
|
ui->menuRecent_Files));
|
||||||
|
recentDocsMenu.last()
|
||||||
|
->setShortcut(QKeySequence(tr("CTRL+")
|
||||||
|
+ QString::number(i + 1)));
|
||||||
|
QObject::connect(recentDocsMenu.last(), SIGNAL(triggered()),
|
||||||
|
this, SLOT(openRecentFile()));
|
||||||
|
ui->menuRecent_Files->addAction(recentDocsMenu.last());
|
||||||
|
|
||||||
|
|
||||||
|
recentProjectsMenu.append(new QAction(tr("Recent Project"),
|
||||||
|
ui->menuRecent_Projects));
|
||||||
|
recentProjectsMenu.last()
|
||||||
|
->setShortcut(QKeySequence(tr("CTRL+SHIFT+") +
|
||||||
|
QString::number(i + 1)));
|
||||||
|
QObject::connect(recentProjectsMenu.last(), SIGNAL(triggered()),
|
||||||
|
this, SLOT(openRecentProject()));
|
||||||
|
ui->menuRecent_Projects->addAction(recentProjectsMenu.last());
|
||||||
|
}
|
||||||
|
refreshRecentMenus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorWindow::addTab(TabContent *doc)
|
void EditorWindow::addTab(TabContent *doc)
|
||||||
|
|
@ -546,6 +587,16 @@ void EditorWindow::openProject()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorWindow::openRecentFile()
|
||||||
|
{
|
||||||
|
loadTabFromSkinFile(dynamic_cast<QAction*>(QObject::sender())->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditorWindow::openRecentProject()
|
||||||
|
{
|
||||||
|
loadProjectFile(dynamic_cast<QAction*>(QObject::sender())->text());
|
||||||
|
}
|
||||||
|
|
||||||
void EditorWindow::configFileChanged(QString configFile)
|
void EditorWindow::configFileChanged(QString configFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -743,6 +794,8 @@ void EditorWindow::loadProjectFile(QString fileName)
|
||||||
|
|
||||||
if(QFile::exists(fileName))
|
if(QFile::exists(fileName))
|
||||||
{
|
{
|
||||||
|
projectToTop(fileName);
|
||||||
|
|
||||||
if(project)
|
if(project)
|
||||||
project->deleteLater();
|
project->deleteLater();
|
||||||
|
|
||||||
|
|
@ -816,3 +869,71 @@ void EditorWindow::createFile(QString filename, QString contents)
|
||||||
|
|
||||||
fout.close();
|
fout.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorWindow::docToTop(QString file)
|
||||||
|
{
|
||||||
|
if(!QFile::exists(file))
|
||||||
|
return;
|
||||||
|
|
||||||
|
int index = recentDocs.indexOf(file);
|
||||||
|
if(index == -1)
|
||||||
|
{
|
||||||
|
/* Bumping off the last file */
|
||||||
|
if(recentDocs.count() >= numRecent)
|
||||||
|
recentDocs.removeLast();
|
||||||
|
recentDocs.prepend(file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Shuffling file to the top of the list */
|
||||||
|
recentDocs.removeAt(index);
|
||||||
|
recentDocs.prepend(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshRecentMenus();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditorWindow::projectToTop(QString file)
|
||||||
|
{
|
||||||
|
if(!QFile::exists(file))
|
||||||
|
return;
|
||||||
|
|
||||||
|
int index = recentProjects.indexOf(file);
|
||||||
|
if(index == -1)
|
||||||
|
{
|
||||||
|
/* Bumping off the last project */
|
||||||
|
if(recentProjects.count() >= numRecent)
|
||||||
|
recentProjects.removeLast();
|
||||||
|
recentProjects.prepend(file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Shuffling file to the top of the list */
|
||||||
|
recentProjects.removeAt(index);
|
||||||
|
recentProjects.prepend(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshRecentMenus();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditorWindow::refreshRecentMenus()
|
||||||
|
{
|
||||||
|
/* First hiding all the menu items */
|
||||||
|
for(int i = 0; i < recentDocsMenu.count(); i++)
|
||||||
|
recentDocsMenu[i]->setVisible(false);
|
||||||
|
for(int i = 0; i < recentProjectsMenu.count(); i++)
|
||||||
|
recentProjectsMenu[i]->setVisible(false);
|
||||||
|
|
||||||
|
/* Then setting the text of and showing any available */
|
||||||
|
for(int i = 0; i < recentDocs.count(); i++)
|
||||||
|
{
|
||||||
|
recentDocsMenu[i]->setText(recentDocs[i]);
|
||||||
|
recentDocsMenu[i]->setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < recentProjects.count(); i++)
|
||||||
|
{
|
||||||
|
recentProjectsMenu[i]->setText(recentProjects[i]);
|
||||||
|
recentProjectsMenu[i]->setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@ class EditorWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
static const int numRecent;
|
||||||
|
|
||||||
EditorWindow(QWidget *parent = 0);
|
EditorWindow(QWidget *parent = 0);
|
||||||
virtual ~EditorWindow();
|
virtual ~EditorWindow();
|
||||||
|
|
||||||
|
|
@ -75,6 +77,8 @@ private slots:
|
||||||
void exportProject();
|
void exportProject();
|
||||||
void openFile();
|
void openFile();
|
||||||
void openProject();
|
void openProject();
|
||||||
|
void openRecentFile();
|
||||||
|
void openRecentProject();
|
||||||
void tabTitleChanged(QString title);
|
void tabTitleChanged(QString title);
|
||||||
void updateCurrent(); /* Generates code in the current tab */
|
void updateCurrent(); /* Generates code in the current tab */
|
||||||
void lineChanged(int line); /* Used for auto-expand */
|
void lineChanged(int line); /* Used for auto-expand */
|
||||||
|
|
@ -100,6 +104,11 @@ private:
|
||||||
void loadProjectFile(QString fileName);
|
void loadProjectFile(QString fileName);
|
||||||
static void createFile(QString filename, QString contents);
|
static void createFile(QString filename, QString contents);
|
||||||
|
|
||||||
|
/* Functions to manipulate the recent projects/documents menus */
|
||||||
|
void docToTop(QString file);
|
||||||
|
void projectToTop(QString file);
|
||||||
|
void refreshRecentMenus();
|
||||||
|
|
||||||
Ui::EditorWindow *ui;
|
Ui::EditorWindow *ui;
|
||||||
PreferencesDialog* prefs;
|
PreferencesDialog* prefs;
|
||||||
QLabel* parseStatus;
|
QLabel* parseStatus;
|
||||||
|
|
@ -110,6 +119,11 @@ private:
|
||||||
QDockWidget* deviceDock;
|
QDockWidget* deviceDock;
|
||||||
SkinTimer* timer;
|
SkinTimer* timer;
|
||||||
QDockWidget* timerDock;
|
QDockWidget* timerDock;
|
||||||
|
|
||||||
|
QStringList recentDocs;
|
||||||
|
QStringList recentProjects;
|
||||||
|
QList<QAction*> recentDocsMenu;
|
||||||
|
QList<QAction*> recentProjectsMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EDITORWINDOW_H
|
#endif // EDITORWINDOW_H
|
||||||
|
|
|
||||||
|
|
@ -40,17 +40,29 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>628</width>
|
<width>628</width>
|
||||||
<height>25</height>
|
<height>27</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&File</string>
|
<string>&File</string>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QMenu" name="menuRecent_Files">
|
||||||
|
<property name="title">
|
||||||
|
<string>Recent Files</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuRecent_Projects">
|
||||||
|
<property name="title">
|
||||||
|
<string>Recent Projects</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
<addaction name="actionNew_Document"/>
|
<addaction name="actionNew_Document"/>
|
||||||
<addaction name="actionNew_Project"/>
|
<addaction name="actionNew_Project"/>
|
||||||
<addaction name="actionOpen_Document"/>
|
<addaction name="actionOpen_Document"/>
|
||||||
<addaction name="actionOpen_Project"/>
|
<addaction name="actionOpen_Project"/>
|
||||||
|
<addaction name="menuRecent_Files"/>
|
||||||
|
<addaction name="menuRecent_Projects"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionClose_Document"/>
|
<addaction name="actionClose_Document"/>
|
||||||
<addaction name="actionClose_Project"/>
|
<addaction name="actionClose_Project"/>
|
||||||
|
|
@ -407,6 +419,28 @@
|
||||||
<string>Ctrl+Shift+X</string>
|
<string>Ctrl+Shift+X</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionFiles">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Files</string>
|
||||||
|
</property>
|
||||||
|
<property name="visible">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionProjects">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Projects</string>
|
||||||
|
</property>
|
||||||
|
<property name="visible">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>projectTree</tabstop>
|
<tabstop>projectTree</tabstop>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,14 @@
|
||||||
|
# ----------------------------------------------------------- #
|
||||||
|
# ----------------------------------------------------------- #
|
||||||
|
# --- This file automatically generated, do not modify! --- #
|
||||||
|
# --- To add a target to the targetdb, add it to the --- #
|
||||||
|
# --- $targets array in buildtargetdb.php and run that --- #
|
||||||
|
# --- script, ensuring that your current directory is --- #
|
||||||
|
# --- utils/themeeditor, and pipe the output into --- #
|
||||||
|
# --- utils/themeeditor/resources/targetdb --- #
|
||||||
|
# ----------------------------------------------------------- #
|
||||||
|
# ----------------------------------------------------------- #
|
||||||
|
|
||||||
archosfmrecorder
|
archosfmrecorder
|
||||||
{
|
{
|
||||||
name : Archos FM Recorder
|
name : Archos FM Recorder
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue