Merging upstream version 0.9.0+20150723.

parent ff2d84f4
......@@ -7,21 +7,24 @@ find_program(SED_PROGRAM sed)
# additional cmake files
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Support Qt5
option(USE_QT5 "Build with Qt5." $ENV{USE_QT5})
include(GNUInstallDirs)
# Support Qt4 for the time being
option(USE_QT4 "Build with Qt4." $ENV{USE_QT4})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_AUTOMOC ON)
if(USE_QT5)
if(USE_QT4)
find_package(Qt4 REQUIRED QtCore QtGui) # Qt
include(${QT_USE_FILE})
message(STATUS "Building with Qt${QTVERSION}")
else()
cmake_minimum_required(VERSION 2.8.11)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5X11Extras REQUIRED)
find_package(Qt5LinguistTools REQUIRED QUIET)
message(STATUS "Building with Qt${Qt5Core_VERSION_STRING}")
else()
find_package(Qt4 REQUIRED QtCore QtGui) # Qt
include(${QT_USE_FILE})
message(STATUS "Building with Qt${QTVERSION}")
endif()
find_package(PkgConfig)
......@@ -40,7 +43,7 @@ add_subdirectory(src)
# install an icon for the application
install(
FILES data/obconf-qt.png
DESTINATION share/icons/hicolor/48x48/apps
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps"
)
# building tarball with CPack -------------------------------------------------
......
# set visibility to hidden to hide symbols, unlesss they're exporeted manually in the code
set(CMAKE_CXX_FLAGS "-DQT_NO_KEYWORDS -fno-exceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_KEYWORDS -fno-exceptions")
if(USE_QT5)
set(QTX_INCLUDE_DIRS "")
set(QTX_LIBRARIES Qt5::Widgets Qt5::X11Extras)
else()
if(USE_QT4)
set(QTX_INCLUDE_DIRS ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTDBUS_DIR})
set(QTX_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDBUS_LIBRARY})
else()
set(QTX_INCLUDE_DIRS "")
set(QTX_LIBRARIES Qt5::Widgets Qt5::X11Extras)
endif()
include_directories(
......@@ -36,10 +36,10 @@ set(obconf-qt_UIS
obconf.ui
)
if(USE_QT5)
qt5_wrap_ui(obconf-qt_UI_H ${obconf-qt_UIS})
else()
if(USE_QT4)
qt4_wrap_ui(obconf-qt_UI_H ${obconf-qt_UIS})
else()
qt5_wrap_ui(obconf-qt_UI_H ${obconf-qt_UIS})
endif()
# The ui code generated by Qt uic contains QMetaObject::connectSlotsByName()
......@@ -61,37 +61,37 @@ option (UPDATE_TRANSLATIONS "Update source translation translations/*.ts files"
set(TRANSLATION_TEMPLATE "translations/obconf-qt.ts")
file(GLOB TS_FILES translations/obconf-qt_*.ts)
if(USE_QT5)
if(USE_QT4)
if (UPDATE_TRANSLATIONS)
qt5_create_translation(QMS_FILES
qt4_create_translation(QMS_FILES
${obconf-qt_SRCS}
${obconf-qt_UI_H}
${TRANSLATION_TEMPLATE}
OPTIONS -locations absolute)
qt5_create_translation(QM_FILES
qt4_create_translation(QMS_FILES
${obconf-qt_SRCS}
${obconf-qt_UI_H}
${TS_FILES}
OPTIONS -locations absolute)
else (UPDATE_TRANSLATIONS)
qt5_add_translation(QM_FILES ${TS_FILES})
qt4_add_translation(QM_FILES ${TS_FILES})
endif (UPDATE_TRANSLATIONS)
else(USE_QT5) # use qt4
else(USE_QT4) # use qt4
if (UPDATE_TRANSLATIONS)
qt4_create_translation(QMS_FILES
qt5_create_translation(QMS_FILES
${obconf-qt_SRCS}
${obconf-qt_UI_H}
${TRANSLATION_TEMPLATE}
OPTIONS -locations absolute)
qt4_create_translation(QMS_FILES
qt5_create_translation(QM_FILES
${obconf-qt_SRCS}
${obconf-qt_UI_H}
${TS_FILES}
OPTIONS -locations absolute)
else (UPDATE_TRANSLATIONS)
qt4_add_translation(QM_FILES ${TS_FILES})
qt5_add_translation(QM_FILES ${TS_FILES})
endif (UPDATE_TRANSLATIONS)
endif(USE_QT5)
endif(USE_QT4)
if(UPDATE_TRANSLATIONS)
add_custom_target(update_obconf-qt_translations ALL DEPENDS ${QMS})
......@@ -117,9 +117,9 @@ add_executable(obconf-qt
)
add_definitions(
-DPACKAGE_DATA_DIR="${CMAKE_INSTALL_PREFIX}/share/obconf-qt"
-DPIXMAPS_DIR="${CMAKE_INSTALL_PREFIX}/share/pixmaps"
-DTHEME_DIR="{CMAKE_INSTALL_PREFIX}/share/openbox/themes"
-DPACKAGE_DATA_DIR="${CMAKE_INSTALL_FULL_DATAROOTDIR}/obconf-qt"
-DPIXMAPS_DIR="${CMAKE_INSTALL_FULL_DATAROOTDIR}/pixmaps"
-DTHEME_DIR="${CMAKE_INSTALL_FULL_DATAROOTDIR}/openbox/themes"
)
target_link_libraries(obconf-qt
......
......@@ -25,7 +25,6 @@
#include "tree.h"
#include <QX11Info>
// FIXME: how to support XCB or Wayland?
#include <X11/Xlib.h>
using namespace Obconf;
......@@ -46,92 +45,28 @@ void MainDialog::desktops_setup_tab() {
gint i;
#if 0
// FIXME
GtkWidget* w;
GtkCellRenderer* render;
GtkTreeViewColumn* column;
w = get_widget("desktop_names");
desktop_store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_BOOLEAN);
gtk_tree_view_set_model(GTK_TREE_VIEW(w), GTK_TREE_MODEL(desktop_store));
g_object_unref(desktop_store);
gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(w)),
GTK_SELECTION_SINGLE);
render = gtk_cell_renderer_text_new();
g_signal_connect(render, "edited",
G_CALLBACK(on_desktop_names_cell_edited),
NULL);
column = gtk_tree_view_column_new_with_attributes
("Name", render, "text", 0, "editable", 1, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
#endif
desktops_read_names();
i = tree_get_int("desktops/popupTime", 875);
ui.desktop_popup->setChecked(i != 0);
ui.desktop_popup_time->setValue(i ? i : 875);
// FIXME enable_stuff();
}
/* FIXME
* static void enable_stuff() {
* GtkWidget* w;
* gboolean b;
*
* w = get_widget("desktop_popup");
* b = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
* w = get_widget("desktop_popup_time");
* gtk_widget_set_sensitive(w, b);
}
*/
void MainDialog::on_desktop_num_valueChanged(int newValue) {
num_desktops = newValue;
desktops_write_number();
desktops_read_names();
}
#if 0
// FIXME
static void MainDialog::on_desktop_names_cell_edited(GtkCellRendererText* cell,
const gchar* path_string,
const gchar* new_text,
gpointer data) {
GtkTreePath* path;
GtkTreeIter it;
gchar* old_text;
GList* lit;
gint i;
path = gtk_tree_path_new_from_string(path_string);
gtk_tree_model_get_iter(GTK_TREE_MODEL(desktop_store), &it, path);
gtk_tree_model_get(GTK_TREE_MODEL(desktop_store), &it, 0, &old_text, -1);
g_free(old_text);
i = gtk_tree_path_get_indices(path)[0];
lit = g_list_nth(desktop_names, i);
g_free(lit->data);
lit->data = g_strdup(new_text);
void MainDialog::on_desktop_names_itemChanged(QListWidgetItem * item) {
QString new_text = item->text();
if(new_text[0]) /* not empty */
gtk_list_store_set(desktop_store, &it, 0, lit->data, -1);
else
gtk_list_store_set(desktop_store, &it, 0, _("(Unnamed desktop)"), -1);
if(new_text.isEmpty())
item->setText(tr("(Unnamed desktop)"));
desktops_write_names();
}
#endif
void MainDialog::desktops_read_names() {
xmlNodePtr n;
gint i;
......@@ -151,7 +86,9 @@ void MainDialog::desktops_read_names() {
if(desktop_name.isEmpty())
desktop_name = tr("(Unnamed desktop)");
ui.desktop_names->addItem(desktop_name);
QListWidgetItem* item = new QListWidgetItem(desktop_name);
item->setFlags(item->flags() | Qt::ItemIsEditable);
ui.desktop_names->addItem(item);
++i;
}
......@@ -159,7 +96,9 @@ void MainDialog::desktops_read_names() {
}
while(i < num_desktops) {
ui.desktop_names->addItem(tr("(Unnamed desktop)"));
QListWidgetItem* item = new QListWidgetItem(tr("(Unnamed desktop)"));
item->setFlags(item->flags() | Qt::ItemIsEditable);
ui.desktop_names->addItem(item);
++i;
}
}
......@@ -216,10 +155,9 @@ void MainDialog::on_desktop_popup_toggled(bool checked) {
}
else
tree_set_int("desktops/popupTime", 0);
// FIXME enable_stuff();
}
void MainDialog::on_desktop_popup_time_valueChanged(int newValue) {
tree_set_int("desktops/popupTime", newValue);
}
......@@ -66,147 +66,84 @@ void MainDialog::dock_setup_tab() {
g_free(s);
#if 0
// FIXME
w = get_widget("dock_position");
gtk_option_menu_set_history(GTK_OPTION_MENU(w), pos);
ui.dock_position->setCurrentIndex(pos);
w = get_widget("dock_float_x");
gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
tree_get_int("dock/floatingX", 0));
bool is_floating = (pos == POSITION_FLOATING);
ui.dock_float_x->setEnabled(is_floating);
ui.dock_float_y->setEnabled(is_floating);
w = get_widget("dock_float_y");
gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
tree_get_int("dock/floatingY", 0));
ui.dock_float_x->setValue(tree_get_int("dock/floatingX", 0));
ui.dock_float_y->setValue(tree_get_int("dock/floatingY", 0));
s = tree_get_string("dock/stacking", "Above");
if(!strcasecmp(s, "Normal"))
w = get_widget("dock_stack_normal");
ui.dock_stack_normal->setChecked(true);
else if(!strcasecmp(s, "Below"))
w = get_widget("dock_stack_bottom");
ui.dock_stack_bottom->setChecked(true);
else
w = get_widget("dock_stack_top");
ui.dock_stack_top->setChecked(true);
g_free(s);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), TRUE);
w = get_widget("dock_direction");
s = tree_get_string("dock/direction", "Vertical");
if(!strcasecmp(s, "Horizontal")) pos = DIRECTION_HORIZONTAL;
else pos = DIRECTION_VERTICAL;
g_free(s);
gtk_option_menu_set_history(GTK_OPTION_MENU(w), pos);
w = get_widget("dock_nostrut");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
tree_get_bool("dock/noStrut", FALSE));
w = get_widget("dock_hide");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
tree_get_bool("dock/autoHide", FALSE));
w = get_widget("dock_hide_delay");
gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
tree_get_int("dock/hideDelay", 300));
w = get_widget("dock_show_delay");
gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
tree_get_int("dock/showDelay", 300));
dock_enable_stuff();
#endif
}
static void dock_enable_stuff() {
/* FIXME
* GtkWidget* w, *s;
* gboolean b;
*
* w = get_widget("dock_position");
* b = gtk_option_menu_get_history(GTK_OPTION_MENU(w)) == POSITION_FLOATING;
*
* s = get_widget("dock_float_x");
* gtk_widget_set_sensitive(s, b);
* s = get_widget("dock_float_y");
* gtk_widget_set_sensitive(s, b);
* s = get_widget("dock_float_label");
* gtk_widget_set_sensitive(s, b);
* s = get_widget("dock_float_label_x");
* gtk_widget_set_sensitive(s, b);
* s = get_widget("dock_nostrut");
* gtk_widget_set_sensitive(s, !b);
*
* w = get_widget("dock_hide");
* b = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
*
* s = get_widget("dock_hide_delay");
* gtk_widget_set_sensitive(s, b);
* s = get_widget("dock_hide_label");
* gtk_widget_set_sensitive(s, b);
* s = get_widget("dock_hide_label_units");
* gtk_widget_set_sensitive(s, b);
* s = get_widget("dock_show_delay");
* gtk_widget_set_sensitive(s, b);
* s = get_widget("dock_show_label");
* gtk_widget_set_sensitive(s, b);
* s = get_widget("dock_show_label_units");
* gtk_widget_set_sensitive(s, b);
*/
}
#if 0
//FIXME
void MainDialog::on_dock_top_left_activate(GtkMenuItem* w, gpointer data) {
tree_set_string("dock/position", "TopLeft");
dock_enable_stuff();
}
void MainDialog::on_dock_top_activate(GtkMenuItem* w, gpointer data) {
tree_set_string("dock/position", "Top");
dock_enable_stuff();
}
void MainDialog::on_dock_top_right_activate(GtkMenuItem* w, gpointer data) {
tree_set_string("dock/position", "TopRight");
dock_enable_stuff();
ui.dock_direction->setCurrentIndex(pos);
ui.dock_nostrut->setChecked(tree_get_bool("dock/noStrut", FALSE));
bool auto_hide = tree_get_bool("dock/autoHide", FALSE);
ui.dock_hide->setChecked(auto_hide);
ui.dock_hide_delay->setEnabled(auto_hide);
ui.dock_hide_delay->setValue(tree_get_int("dock/hideDelay", 300));
ui.dock_show_delay->setEnabled(auto_hide);
ui.dock_show_delay->setValue(tree_get_int("dock/showDelay", 300));
}
void MainDialog::on_dock_position_currentIndexChanged(int index) {
const char* val;
bool is_floating = false;
switch(index) {
case POSITION_TOPLEFT:
default:
val = "TopLeft";
break;
case POSITION_TOP:
val = "Top";
break;
case POSITION_TOPRIGHT:
val = "TopRight";
break;
case POSITION_LEFT:
val = "Left";
break;
case POSITION_RIGHT:
val = "Right";
break;
case POSITION_BOTTOMLEFT:
val = "BottomLeft";
break;
case POSITION_BOTTOM:
val = "Bottom";
break;
case POSITION_BOTTOMRIGHT:
val = "BottomRight";
break;
case POSITION_FLOATING:
val = "Floating";
is_floating = true;
break;
}
tree_set_string("dock/position", val);
ui.dock_float_x->setEnabled(is_floating);
ui.dock_float_y->setEnabled(is_floating);
}
void MainDialog::on_dock_left_activate(GtkMenuItem* w, gpointer data) {
tree_set_string("dock/position", "Left");
dock_enable_stuff();
}
void MainDialog::on_dock_right_activate(GtkMenuItem* w, gpointer data) {
tree_set_string("dock/position", "Right");
dock_enable_stuff();
}
void MainDialog::on_dock_bottom_left_activate(GtkMenuItem* w, gpointer data) {
tree_set_string("dock/position", "BottomLeft");
dock_enable_stuff();
}
void MainDialog::on_dock_bottom_activate(GtkMenuItem* w, gpointer data) {
tree_set_string("dock/position", "Bottom");
dock_enable_stuff();
}
void MainDialog::on_dock_bottom_right_activate(GtkMenuItem* w, gpointer data) {
tree_set_string("dock/position", "BottomRight");
dock_enable_stuff();
}
void MainDialog::on_dock_floating_activate(GtkMenuItem* w, gpointer data) {
tree_set_string("dock/position", "Floating");
dock_enable_stuff();
}
#endif
void MainDialog::on_dock_float_x_valueChanged(int newValue) {
tree_set_int("dock/floatingX", newValue);
}
......@@ -215,31 +152,25 @@ void MainDialog::on_dock_float_y_valueChanged(int newValue) {
tree_set_int("dock/floatingY", newValue);
}
void MainDialog::on_dock_stacking_top_toggled(bool checked) {
void MainDialog::on_dock_stack_top_toggled(bool checked) {
if(checked)
tree_set_string("dock/stacking", "Above");
}
void MainDialog::on_dock_stacking_normal_toggled(bool checked) {
void MainDialog::on_dock_stack_normal_toggled(bool checked) {
if(checked)
tree_set_string("dock/stacking", "Normal");
}
void MainDialog::on_dock_stacking_bottom_toggled(bool checked) {
void MainDialog::on_dock_stack_bottom_toggled(bool checked) {
if(checked)
tree_set_string("dock/stacking", "Below");
}
#if 0
// FIXME
void MainDialog::on_dock_horizontal_activate(GtkMenuItem* w, gpointer data) {
tree_set_string("dock/direction", "Horizontal");
}
void MainDialog::on_dock_vertical_activate(GtkMenuItem* w, gpointer data) {
tree_set_string("dock/direction", "Vertical");
void MainDialog::on_dock_direction_currentIndexChanged(int index) {
const char* val = (index == DIRECTION_VERTICAL ? "Vertical" : "Horizontal");
tree_set_string("dock/direction", val);
}
#endif
void MainDialog::on_dock_nostrut_toggled(bool checked) {
tree_set_bool("dock/noStrut", checked);
......@@ -247,7 +178,6 @@ void MainDialog::on_dock_nostrut_toggled(bool checked) {
void MainDialog::on_dock_hide_toggled(bool checked) {
tree_set_bool("dock/autoHide", checked);
dock_enable_stuff();
}
void MainDialog::on_dock_hide_delay_valueChanged(int newValue) {
......@@ -258,3 +188,4 @@ void MainDialog::on_dock_show_delay_valueChanged(int newValue) {
tree_set_int("dock/showDelay", newValue);
}
......@@ -75,9 +75,10 @@ void MainDialog::reject() {
void MainDialog::on_about_clicked() {
QMessageBox::about(this, tr("About ObConf-Qt"),
tr("A preferences manager for Openbox\n\n"
"Copyright (c) 2003-2013\n\n"
"Copyright (c) 2014-2015\n\n"
"Authors:\n"
"* Hong Jen Yee (PCMan) <pcman.tw@gmail.com>\n"
"* Hong Jen Yee (PCMan) <pcman.tw@gmail.com>\n\n"
"The program is based on ObConf developed by the following developers.\n"
"* Dana Jansens <danakj@orodu.net>\n"
"* Tim Riley <tr@slackzone.org>\n"
"* Javeed Shaikh <syscrash2k@gmail.com>")
......
......@@ -141,17 +141,20 @@ private Q_SLOTS:
void on_desktop_num_valueChanged(int newValue);
void on_desktop_popup_toggled(bool checked);
void on_desktop_popup_time_valueChanged(int newValue);
void on_desktop_names_itemChanged(QListWidgetItem * item);
// docks
void on_dock_float_x_valueChanged(int newValue);
void on_dock_float_y_valueChanged(int newValue);
void on_dock_stacking_top_toggled(bool checked);
void on_dock_stacking_normal_toggled(bool checked);
void on_dock_stacking_bottom_toggled(bool checked);
void on_dock_stack_top_toggled(bool checked);
void on_dock_stack_normal_toggled(bool checked);
void on_dock_stack_bottom_toggled(bool checked);
void on_dock_nostrut_toggled(bool checked);
void on_dock_hide_toggled(bool checked);
void on_dock_hide_delay_valueChanged(int newValue);
void on_dock_show_delay_valueChanged(int newValue);
void on_dock_position_currentIndexChanged(int index);
void on_dock_direction_currentIndexChanged(int index);
private:
Ui::MainDialog ui;
......
This diff is collapsed.
This diff is collapsed.
Name[de]=Fenstermanager Openbox
GenericName[de]=Openbox Einstellungen
Comment[de]=Konfiguration des Fenstermanagers Openbox (Qt-Version)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment