const& params++, no need to rebuild menu when layout changes
This commit is contained in:
		@@ -45,7 +45,7 @@ LayoutManager::~LayoutManager() {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString LayoutManager::getFileName( QString layoutname ) {
 | 
			
		||||
QString LayoutManager::getFileName(const QString& layoutname ) {
 | 
			
		||||
    return QString("%1%2.lyt").arg(settingsDir, layoutname);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -230,8 +230,7 @@ void LayoutManager::saveAs() {
 | 
			
		||||
void LayoutManager::saveDefault() {
 | 
			
		||||
    QFile file( settingsDir + "layout");
 | 
			
		||||
    if (file.open(QIODevice::WriteOnly)) {
 | 
			
		||||
        QTextStream stream(&file);
 | 
			
		||||
        stream << currentLayout;
 | 
			
		||||
        QTextStream(&file) << currentLayout;
 | 
			
		||||
        file.close();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -265,9 +264,19 @@ QStringList LayoutManager::getLayoutNames() const {
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void LayoutManager::setLayoutName(QString name) {
 | 
			
		||||
    currentLayout = name;
 | 
			
		||||
    fillPopup();
 | 
			
		||||
void LayoutManager::setLayoutName(const QString& name) {
 | 
			
		||||
    QList<QAction*> actions = layoutGroup->actions();
 | 
			
		||||
    bool found = false;
 | 
			
		||||
    for (int i = 0; i < actions.size(); ++ i) {
 | 
			
		||||
        QAction* action = actions[i];
 | 
			
		||||
        if (action->data().toString() == name) {
 | 
			
		||||
            action->setChecked(true);
 | 
			
		||||
            found = true;
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    currentLayout = found ? name : NL;
 | 
			
		||||
 | 
			
		||||
    if (le) {
 | 
			
		||||
        le->setLayout(name);
 | 
			
		||||
 
 | 
			
		||||
@@ -71,9 +71,9 @@ class LayoutManager : public QObject {
 | 
			
		||||
        void layoutTriggered();
 | 
			
		||||
	private:
 | 
			
		||||
		//change to the given layout name and make all the necesary adjustments
 | 
			
		||||
		void setLayoutName(QString name);
 | 
			
		||||
        void setLayoutName(const QString& name);
 | 
			
		||||
		//get the file name for a layout name
 | 
			
		||||
		QString getFileName( QString layoutname );
 | 
			
		||||
        QString getFileName(const QString& layoutname);
 | 
			
		||||
        //the directory in wich the joystick devices are (e.g. "/dev/input")
 | 
			
		||||
        QString devdir;
 | 
			
		||||
        QString settingsDir;
 | 
			
		||||
 
 | 
			
		||||
@@ -84,7 +84,7 @@ LayoutEdit::LayoutEdit( LayoutManager* l ): QWidget(NULL) {
 | 
			
		||||
    this->show();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void LayoutEdit::setLayout(QString layout) {
 | 
			
		||||
void LayoutEdit::setLayout(const QString &layout) {
 | 
			
		||||
    //change the text,
 | 
			
		||||
    cmbLayouts->setCurrentIndex(lm->getLayoutNames().indexOf(layout));
 | 
			
		||||
    //update all the JoyPadWidgets.
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ class LayoutEdit : public QWidget {
 | 
			
		||||
	public:
 | 
			
		||||
        LayoutEdit( LayoutManager* l );
 | 
			
		||||
		//swap to a new layout
 | 
			
		||||
		void setLayout(QString layout);
 | 
			
		||||
        void setLayout(const QString& layout);
 | 
			
		||||
		//update the list of available layouts
 | 
			
		||||
		void updateLayoutList();
 | 
			
		||||
        void updateJoypadWidgets();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user