/* * Copyright 2008 Aike J Sommer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2, * or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KEPHAL_BACKENDCONFIGURATIONS_H #define KEPHAL_BACKENDCONFIGURATIONS_H #include #include #include #include "configurations.h" namespace Kephal { /** * A configuration forming part of the backend (Kephal service) */ class BackendConfiguration : public Configuration { Q_OBJECT public: BackendConfiguration(QObject * parent); /** * Returns the real layout, with screen-sizes * taken from the actual Outputs. * * @param simpleLayout The layout as returned * from layout(). * @param outputScreens A mapping of Outputs * to Screens. * @param outputSizes The sizes to use for the * Outputs instead of the current ones. * WILL: used by XMLConf::resizeLayout() */ QMap realLayout(const QMap & simpleLayout, const QMap & outputScreens, const QMap & outputSizes); /** * Returns the real layout, with screen-sizes * taken from the actual Outputs. * * @param simpleLayout The layout as returned * from layout(). * @param outputScreens A mapping of Outputs * to Screens. */ QMap realLayout(const QMap & simpleLayout, const QMap & outputScreens); /** * Returns the real layout, with screen-sizes * taken from the actual Outputs. * This will calculate the layout by calling * layout(). * * @param outputScreens A mapping of Outputs * to Screens. * WILL used by XMLConfiguration::activate(Configuration*) * WILL used by XMLConfiguration::calcMatchingLayout() * WILL used by XMLConfiguration::simpleConfigurationsPositions() */ QMap realLayout(const QMap & outputScreens); /** * Returns the real layout, with screen-sizes * taken from the actual Outputs. * This will calculate the layout by calling * layout() and use the Output to Screen * mapping as currently active if possible. */ QMap realLayout(); /** * Returns a set of points covered in the * layout returned by layout(). */ QSet positions(); /** * Returns the positions as in positions * to which the Screen can be cloned. */ QSet clonePositions(int screen); /** * Returns the layout if the Screen screen * was to be cloned to any of the other * Screens. */ QMap cloneLayout(int screen); /** * Returns the possible positions as in * positions() to move the Screen screen * to. */ QSet possiblePositions(int screen) const; private: void simpleToReal(QMap & simpleLayout, const QMap & screenSizes, int index, QMap & screens) const; QList > partition(int screen) const; QSet border(QSet screens) const; }; /** * A manager of configurations, on the backend */ class BackendConfigurations : public Configurations { Q_OBJECT public: static BackendConfigurations * self(); BackendConfigurations(QObject * parent); virtual ~BackendConfigurations(); /** * Find the Configuration for the currently * connected Outputs. */ virtual Configuration * findConfiguration() = 0; /** * Apply Output-specific settings such as size, * refresh-rate and rotation. */ virtual void applyOutputSettings() = 0; virtual BackendConfiguration * activeBackendConfiguration(); private: static BackendConfigurations * s_instance; }; } #endif // KEPHAL_BACKENDCONFIGURATIONS_H