Commit 0ce59d1a authored by Christoffer Ackelman's avatar Christoffer Ackelman

Replaced .toLocal8Bit().data() with qPrintable()

parent 0b796438
......@@ -182,8 +182,7 @@ void GsdAttrQtWidget::activate_cmd_input()
attr->attrnav->set_inputfocus();
if (attr->input_open) {
QByteArray text = attr->cmd_input->text().toLocal8Bit();
attr->attrnav->set_attr_value(text.data());
attr->attrnav->set_attr_value(qPrintable(attr->cmd_input->text()));
attr->cmd_input->setVisible(false);
attr->set_prompt("");
attr->input_open = 0;
......
......@@ -221,8 +221,7 @@ void GsdmlAttrQtWidget::activate_cmd_entry()
attr->attrnav->set_inputfocus();
if (attr->input_open) {
QByteArray text = attr->cmd_entry->text().toLocal8Bit();
attr->attrnav->set_attr_value(text.data());
attr->attrnav->set_attr_value(qPrintable(attr->cmd_entry->text()));
attr->cmd_entry->setVisible(false);
attr->set_prompt("");
attr->input_open = 0;
......
......@@ -113,7 +113,7 @@ static char null_str[] = "";
//
// Convert attribute string to value
//
int GsdAttrNav::attr_string_to_value(int type_id, char* value_str,
int GsdAttrNav::attr_string_to_value(int type_id, const char* value_str,
void* buffer_ptr, int buff_size, int attr_size)
{
switch (type_id) {
......@@ -485,7 +485,7 @@ int GsdAttrNav::get_select(ItemPb** item)
//
// Set attribute value
//
int GsdAttrNav::set_attr_value(char* value_str)
int GsdAttrNav::set_attr_value(const char* value_str)
{
brow_tNode* node_list;
int node_count;
......
......@@ -123,7 +123,7 @@ public:
}
void start_trace(pwr_tObjid Objid, char* object_str);
int set_attr_value(char* value_str);
int set_attr_value(const char* value_str);
int check_attr_value(char** value);
int get_select(pwr_sAttrRef* attrref, int* is_attr);
void message(char sev, const char* text);
......@@ -143,7 +143,7 @@ public:
flow_eTraceType type, void** p);
static int trace_disconnect_bc(brow_tObject object);
static int init_brow_cb(FlowCtx* fctx, void* client_data);
static int attr_string_to_value(int type_id, char* value_str,
static int attr_string_to_value(int type_id, const char* value_str,
void* buffer_ptr, int buff_size, int attr_size);
static void attrvalue_to_string(int type_id, void* value_ptr, char* str,
int size, int* len, char* format);
......
......@@ -2254,7 +2254,7 @@ int pn_gsdml::datavalue_to_string(gsdml_eValueDataType datatype, void* value,
}
int pn_gsdml::string_to_datavalue(
gsdml_eValueDataType datatype, void* value, unsigned int size, char* str)
gsdml_eValueDataType datatype, void* value, unsigned int size, const char* str)
{
switch (datatype) {
case gsdml_eValueDataType_Integer8:
......
......@@ -1569,7 +1569,7 @@ public:
int datavalue_to_string(gsdml_eValueDataType datatype, void* value,
unsigned int size, char* str, unsigned int strsize);
int string_to_datavalue(
gsdml_eValueDataType datatype, void* value, unsigned int size, char* str);
gsdml_eValueDataType datatype, void* value, unsigned int size, const char* str);
int get_datavalue_length(
gsdml_eValueDataType datatype, int strlength, unsigned int* len);
void set_classes(gsdml_sModuleClass* mclist)
......
......@@ -112,7 +112,7 @@ static char null_str[] = "";
//
// Convert attribute string to value
//
int GsdmlAttrNav::attr_string_to_value(int type_id, char* value_str,
int GsdmlAttrNav::attr_string_to_value(int type_id, const char* value_str,
void* buffer_ptr, int buff_size, int attr_size)
{
switch (type_id) {
......@@ -577,7 +577,7 @@ int GsdmlAttrNav::get_select(ItemPn** item)
//
// Set attribute value
//
int GsdmlAttrNav::set_attr_value(char* value_str)
int GsdmlAttrNav::set_attr_value(const char* value_str)
{
brow_tNode* node_list;
int node_count;
......@@ -1961,7 +1961,7 @@ int ItemPnBase::scan(GsdmlAttrNav* attrnav, void* p)
return 1;
}
void ItemPnBase::value_changed(GsdmlAttrNav* attrnav, char* value_str)
void ItemPnBase::value_changed(GsdmlAttrNav* attrnav, const char* value_str)
{
char buffer[1024];
int sts;
......@@ -4001,7 +4001,7 @@ int ItemPnParValue::scan(GsdmlAttrNav* attrnav, void* p)
return 1;
}
void ItemPnParValue::value_changed(GsdmlAttrNav* attrnav, char* value_str)
void ItemPnParValue::value_changed(GsdmlAttrNav* attrnav, const char* value_str)
{
int sts;
......
......@@ -157,7 +157,7 @@ public:
}
void start_trace(pwr_tObjid Objid, char* object_str);
int set_attr_value(char* value_str);
int set_attr_value(const char* value_str);
int check_attr_value(char** value);
int get_select(pwr_sAttrRef* attrref, int* is_attr);
void message(char sev, const char* text);
......@@ -198,7 +198,7 @@ public:
flow_eTraceType type, void** p);
static int trace_disconnect_bc(brow_tObject object);
static int init_brow_cb(FlowCtx* fctx, void* client_data);
static int attr_string_to_value(int type_id, char* value_str,
static int attr_string_to_value(int type_id, const char* value_str,
void* buffer_ptr, int buff_size, int attr_size);
static void attrvalue_to_string(int type_id, void* value_ptr, char* str,
int size, int* len, char* format);
......@@ -239,7 +239,7 @@ public:
virtual void update(GsdmlAttrNav* attrnav)
{
}
virtual void value_changed(GsdmlAttrNav* attrnav, char* value_str)
virtual void value_changed(GsdmlAttrNav* attrnav, const char* value_str)
{
}
};
......@@ -262,7 +262,7 @@ public:
int subgraph;
virtual int scan(GsdmlAttrNav* attrnav, void* p);
virtual void value_changed(GsdmlAttrNav* attrnav, char* value_str);
virtual void value_changed(GsdmlAttrNav* attrnav, const char* value_str);
};
//! Item for an enum attribute.
......@@ -524,7 +524,7 @@ public:
int noedit;
int scan(GsdmlAttrNav* attrnav, void* p);
void value_changed(GsdmlAttrNav* attrnav, char* value_str);
void value_changed(GsdmlAttrNav* attrnav, const char* value_str);
};
class ParEnumValue {
......
......@@ -591,7 +591,7 @@ void WUtedGtk::set_command_window(char* cmd)
{
}
void WUtedGtk::configure_quals(char* label)
void WUtedGtk::configure_quals(const char* label)
{
int i;
int index;
......
......@@ -83,7 +83,7 @@ public:
void raise_window();
void clock_cursor();
void reset_cursor();
void configure_quals(char* label);
void configure_quals(const char* label);
void enable_entries(int enable);
void get_value(int idx, char* str, int len);
void questionbox(char* question_title, char* question_text,
......
......@@ -907,7 +907,7 @@ void WUtedMotif::set_command_window(char* cmd)
XmStringFree(cstr);
}
void WUtedMotif::configure_quals(char* label)
void WUtedMotif::configure_quals(const char* label)
{
Arg arg[1];
Arg args[1];
......
......@@ -81,7 +81,7 @@ public:
void raise_window();
void clock_cursor();
void reset_cursor();
void configure_quals(char* label);
void configure_quals(const char* label);
void enable_entries(int enable);
void get_value(int idx, char* str, int len);
void questionbox(char* question_title, char* question_text,
......
......@@ -523,8 +523,7 @@ int WFoeQt::modify_popup(unsigned long popupmenu_mask, int x, int y)
QMenu* menu = new QMenu(toplevel);
for (int i = 0; i < bsize; i++) {
if (popupmenu_mask & (1 << i)) {
QByteArray ba = menu_callbacks[i].toLocal8Bit();
addMenuItem(toplevel, menu, buttontext[i], ba.data());
addMenuItem(toplevel, menu, buttontext[i], qPrintable(menu_callbacks[i]));
}
}
......@@ -922,9 +921,8 @@ pwr_tStatus WFoeQt::create_window(int x_top, int y_top, int width_adb,
for (int i = 0; i < 5; i++) {
double num = pow(2, i) / (16 * 5);
QString txt = QString::number(i + 1).prepend('_');
QByteArray ba = txt.toLocal8Bit();
QAction* view_gs_t = addMenuRadioItem(
toplevel, view_gs, ba.data(), SLOT(activate_gridsize()), view_gs_group);
QAction* view_gs_t = addMenuRadioItem(toplevel, view_gs, qPrintable(txt),
SLOT(activate_gridsize()), view_gs_group);
view_gs_t->setData(num);
}
......
......@@ -82,8 +82,7 @@ void WUtedQtWidget::activate_command()
for (int j = 0; uted->optmenubuttons[j]; j++) {
if (sender() == uted->optmenubuttons[j]) {
QByteArray label = uted->optmenubuttons[j]->text().toLocal8Bit();
uted->configure_quals(label.data());
uted->configure_quals(qPrintable(uted->optmenubuttons[j]->text()));
}
}
}
......@@ -347,7 +346,7 @@ void WUtedQt::set_command_window(char* cmd)
{
}
void WUtedQt::configure_quals(char* label)
void WUtedQt::configure_quals(const char* label)
{
int i;
int index;
......
......@@ -80,7 +80,7 @@ public:
void raise_window();
void clock_cursor();
void reset_cursor();
void configure_quals(char* label);
void configure_quals(const char* label);
void enable_entries(int enable);
void get_value(int idx, char* str, int len);
void questionbox(char* question_title, char* question_text,
......
......@@ -77,8 +77,7 @@ void WVselQtWidget::activate_ok()
char selected_text[80];
QList<QTreeWidgetItem*> selection = sel->volumelist->selectedItems();
if (selection.size() > 0) {
QByteArray text = selection[0]->text(0).toLocal8Bit();
strcpy(selected_text, text.data());
strcpy(selected_text, qPrintable(selection[0]->text(0)));
}
pwr_tVid vid;
......
......@@ -437,7 +437,7 @@ int WUted::execute(int show)
return FOE__SUCCESS;
}
pwr_tStatus WUted::get_command_index(char* label, int* index)
pwr_tStatus WUted::get_command_index(const char* label, int* index)
{
uted_sCommand* command_ptr;
int i;
......
......@@ -127,7 +127,7 @@ public:
virtual void reset_cursor()
{
}
virtual void configure_quals(char* label)
virtual void configure_quals(const char* label)
{
}
virtual void enable_entries(int enable)
......@@ -146,7 +146,7 @@ public:
}
static void get_message_error(pwr_tStatus sts, char* str);
static pwr_tStatus get_command_index(char* label, int* index);
static pwr_tStatus get_command_index(const char* label, int* index);
static void get_filename(char* filename);
};
......
......@@ -173,8 +173,7 @@ void XttQt::open_change_value()
cmd_entry->setFocus();
cmd_entry->setText("");
QByteArray ba = translate_utf8("value >").toLocal8Bit();
set_prompt(ba.data());
set_prompt(qPrintable(translate_utf8("value >")));
input_open = 1;
}
......
......@@ -183,12 +183,10 @@ pwr_tStatus CoLoginQt::get_values()
char user[40];
/* Get UserName */
QByteArray ba = username->text().toLocal8Bit();
strcpy(user, ba.data());
strcpy(user, qPrintable(username->text()));
/* Get Password */
ba = password->text().toLocal8Bit();
strcpy(passwd, ba.data());
strcpy(passwd, qPrintable(password->text()));
pwr_tStatus sts = user_check(groupname, user, passwd);
if (EVEN(sts)) {
......
......@@ -134,8 +134,7 @@ void MsgWindowQt::print()
pwr_tStatus sts;
char title[80];
QByteArray ba = translate_utf8(name).toLocal8Bit();
strncpy(title, ba.data(), sizeof(title));
strncpy(title, qPrintable(translate_utf8(name)), sizeof(title));
CoWowQt::CreateBrowPrintDialogQt(title, msgnav->brow->ctx,
flow_eOrientation_Landscape, 1.4, toplevel, &sts);
......
......@@ -87,9 +87,7 @@ void dbg_print(const char* file, int line, QString str)
file2 = file2 ? (file2 + 1) : file;
fprintf(stderr, " %s:%d: ", file2, line);
// 3. print the actual debug message
QByteArray ba = str.toLocal8Bit();
const char* c_str = ba.data();
fprintf(stderr, "%s\n", c_str);
fprintf(stderr, "%s\n", qPrintable(str));
}
}
......
......@@ -528,8 +528,7 @@ void CoWowQt::CreateFileSelDia(const char* title, void* parent_ctx,
object->parent_wid, fl(title), fl(folder), filter);
if (!filename.isNull()) {
QByteArray ba = filename.toLocal8Bit();
strcpy(fname, ba.data());
strcpy(fname, qPrintable(filename));
}
if (file_selected_cb) {
......@@ -671,8 +670,7 @@ void CoWowEntryQt::keyPressEvent(QKeyEvent* event)
for (int i = m_re->m_recall_size - 2; i >= 0; i--) {
strcpy(m_re->m_recall[i + 1], m_re->m_recall[i]);
}
QByteArray ba = txt.toLocal8Bit();
strncpy(m_re->m_recall[0], ba.data(), m_re->m_line_size);
strncpy(m_re->m_recall[0], qPrintable(txt), m_re->m_line_size);
m_re->m_recall[0][m_re->m_line_size - 1] = 0;
}
m_re->m_current_recall_line = 0;
......
......@@ -153,8 +153,7 @@ void CoXHelpQt::print()
pwr_tStatus sts;
char title[80];
QByteArray ba = translate_utf8("Help").toLocal8Bit();
strcpy(title, ba.data());
strcpy(title, qPrintable(translate_utf8("Help")));
CoWowQt::CreateBrowPrintDialogQt(title, xhelpnav->brow->ctx,
flow_eOrientation_Portrait, 0.7, toplevel, &sts);
......
......@@ -372,16 +372,15 @@ void GeCurveQtWidget::activate_export_ok()
}
if (curve->layout_mask & curve_mEnable_ExportTime) {
QByteArray ba = curve->export_fromtime_widget->text().toLocal8Bit();
sts = time_AsciiToA(ba.data(), &from);
sts = time_AsciiToA(
qPrintable(curve->export_fromtime_widget->text()), &from);
if (EVEN(sts)) {
curve->wow->DisplayError("Syntax Error", "From time syntax error");
return;
}
ba = curve->export_totime_widget->text().toLocal8Bit();
sts = time_AsciiToA(ba.data(), &to);
sts = time_AsciiToA(qPrintable(curve->export_totime_widget->text()), &to);
if (EVEN(sts)) {
curve->wow->DisplayError("Syntax Error", "To time syntax error");
return;
......@@ -395,8 +394,7 @@ void GeCurveQtWidget::activate_export_ok()
}
}
QByteArray ba = curve->export_filename_widget->text().toLocal8Bit();
strcpy(filename, ba.data());
strcpy(filename, qPrintable(curve->export_filename_widget->text()));
curve->export_widget->setVisible(false);
......@@ -417,9 +415,9 @@ void GeCurveQtWidget::activate_export_cancel()
void GeCurveQtWidget::activate_export_browse()
{
QByteArray ba = translate_utf8("File Selection").toLocal8Bit();
curve->wow->CreateFileSelDia(ba.data(), (void*)this,
GeCurveQt::export_file_selected_cb, wow_eFileSelType_History);
curve->wow->CreateFileSelDia(qPrintable(translate_utf8("File Selection")),
(void*)this, GeCurveQt::export_file_selected_cb,
wow_eFileSelType_History);
}
void GeCurveQt::export_file_selected_cb(
......@@ -584,14 +582,12 @@ void GeCurveQt::set_times_sensitivity(int sensitive)
pwr_tStatus GeCurveQt::get_times(pwr_tTime* from, pwr_tTime* to)
{
QByteArray from_p = timebox_start_time->text().toLocal8Bit();
pwr_tStatus sts = time_FormAsciiToA(from_p.data(), SWE, SECOND, from);
pwr_tStatus sts = time_FormAsciiToA(qPrintable(timebox_start_time->text()), SWE, SECOND, from);
if (EVEN(sts)) {
return sts;
}
QByteArray to_p = timebox_stop_time->text().toLocal8Bit();
sts = time_FormAsciiToA(to_p.data(), SWE, SECOND, to);
sts = time_FormAsciiToA(qPrintable(timebox_stop_time->text()), SWE, SECOND, to);
if (EVEN(sts)) {
return sts;
}
......
......@@ -115,9 +115,9 @@ void GeItemViewQt::update()
}
}
void GeItemViewQt::update(char* full_name, int event)
void GeItemViewQt::update(const char* full_name, int event)
{
char* name_p = strrchr(full_name, '/');
char* name_p = (char *) strrchr(full_name, '/');
full_name = strstr(name_p, ".pwg");
if (!full_name) {
return;
......@@ -181,21 +181,20 @@ void GeItemViewQt::activate_menu_open()
void GeItemViewQt::activate_menu_delete()
{
QByteArray sel_text = selected_text().toLocal8Bit();
if (sel_text.data()) {
if (qPrintable(selected_text())) {
int rv;
char title[] = "Delete graph";
char message[64];
pwr_tCmd cmd;
sprintf(message, "Do you want to delete %s?", sel_text.data());
sprintf(message, "Do you want to delete %s?", qPrintable(selected_text()));
rv = ge_ctx->create_modal_dialog(
title, message, "Yes", "Cancel", NULL, NULL);
if (rv != wow_eModalDialogReturn_Button1) {
return;
}
sprintf(cmd, "rm -f $pwrp_pop/%s.pwg", sel_text.data());
sprintf(cmd, "rm -f $pwrp_pop/%s.pwg", qPrintable(selected_text()));
system(cmd);
}
}
......@@ -268,8 +267,7 @@ void GeItemViewQt::directory_changed(const QString& path)
if (!files2.contains(files[i])) {
// File deleted
if (!files[i].contains("__p")) {
QByteArray ba = files[i].toLocal8Bit();
update(ba.data(), 1);
update(qPrintable(files[i]), 1);
}
}
}
......@@ -278,8 +276,7 @@ void GeItemViewQt::directory_changed(const QString& path)
if (!files.contains(files2[i])) {
// File created
if (!files2[i].contains("__p")) {
QByteArray ba = files2[i].toLocal8Bit();
update(ba.data(), 0);
update(qPrintable(files2[i]), 0);
}
}
}
......@@ -326,8 +323,7 @@ void GeItemViewQt::activate_tree_widget(QTreeWidgetItem* item, int idx)
QString sel_text = selected_text(tree_widget);
if (!sel_text.isNull()) {
QByteArray ba = sel_text.toLocal8Bit();
ge_ctx->open_graph(ba.data());
ge_ctx->open_graph(qPrintable(sel_text));
}
}
......
......@@ -58,7 +58,7 @@ public:
QWidget* widget();
void update();
void update(char*, int);
void update(const char*, int);
protected:
void focusOutEvent(QFocusEvent* event);
......
......@@ -1508,9 +1508,9 @@ GeQt::GeQt(void* x_parent_ctx, QWidget* x_parent_widget,
= cons->addMenu(translate_utf8("Corners &Round Amount"));
for (int i = 0; i < 5; i++) {
double num = pow(2, i) / 4.0;
QByteArray ba = QString::number(num, 'f').toLocal8Bit();
QAction* cons_round_amount_t = addMenuRadioItem(toplevel, cons_round_amount,
ba.data(), SLOT(activate_round_amount()), round_amount_group);
qPrintable(QString::number(num, 'f')), SLOT(activate_round_amount()),
round_amount_group);
cons_round_amount_t->setData(num);
if (i == 1) {
cons_round_amount_t->setChecked(true);
......
......@@ -538,7 +538,7 @@ void Ge::export_gejava(Ge* gectx, char* name)
}
}
void Ge::open_graph(char* name)
void Ge::open_graph(const char* name)
{
pwr_tFileName filename;
char graphname[80];
......
......@@ -190,7 +190,7 @@ public:
void save_and_close();
void clear_all();
void open_graph(char* name);
void open_graph(const char* name);
int set_focus(void* component);
void close();
int select_object(char* name);
......
......@@ -269,11 +269,9 @@ void CLogQtWidget::filter_apply_cb()
bool fatal = clog->show_fatal_w->isChecked();
bool text = clog->show_text_w->isChecked();
QByteArray str = clog->filter_string_w->text().toLocal8Bit();
clog->set_clock_cursor();
clog->clognav->set_filter(
success, info, warning, error, fatal, text, str.data());
clog->clognav->set_filter(success, info, warning, error, fatal, text,
qPrintable(clog->filter_string_w->text()));
clog->reset_cursor();
}
......
......@@ -163,8 +163,8 @@ void XttStreamQtWidget::error_cb(Phonon::ErrorType error)
{
printf("Message %d\n", error);
/* Print error details on the screen */
QByteArray err = stream->playbin2->mediaObject()->errorString().toLocal8Bit();
printf("Error received from element: %s\n", err.data());
printf("Error received from element: %s\n",
qPrintable(stream->playbin2->mediaObject()->errorString()));
if (error == Phonon::FatalError) {
stream->no_uri = 1;
......@@ -505,19 +505,17 @@ XttStreamQt::XttStreamQt(QWidget* st_parent_wid, void* st_parent_ctx,
for (int i = 0; i < 10; i++) {
QString text1, text2, text3;
text1 += "PresetPosition[";
text1 = "PresetPosition[";
text1 += QString::number(i);
text1 += "].Description";
QByteArray ba1 = text1.toLocal8Bit();
text2 += "Preset position ";
text2 = "Preset position ";
text2 += QString::number(i + 1);
QByteArray ba2 = text2.toLocal8Bit();
text3 += "$pwr_exe/xtt_pos";
text3 = "$pwr_exe/xtt_pos";
text3 += QString::number(i + 1);
text3 += ".png";
QByteArray ba3 = text3.toLocal8Bit();
QAction* a = addToolItemSpecial(tools, ba1.data(), ba2.data(),
SLOT(activate_preset_position()), ba3.data());
QAction* a
= addToolItemSpecial(tools, qPrintable(text1), qPrintable(text2),
SLOT(activate_preset_position()), qPrintable(text3));
a->setData(i);
}
......@@ -654,8 +652,7 @@ void XttStreamQt::create_popup_menu(int x, int y)
QString text;
text += "Position ";
text += QString::number(i + 1);
QByteArray ba = text.toLocal8Bit();
QAction* a = addMenuItem(toplevel, menu_preset_store, ba.data(),
QAction* a = addMenuItem(toplevel, menu_preset_store, qPrintable(text),
SLOT(activate_preset_store_pos()));
a->setData(i);
}
......
......@@ -295,7 +295,7 @@ CLogNavBrow::~CLogNavBrow()
}
void CLogNav::set_filter(bool success, bool info, bool warning, bool error,
bool fatal, bool text, char* str)
bool fatal, bool text, const char* str)
{
filter.show_success = success;
filter.show_info = info;
......
......@@ -148,7 +148,7 @@ public:
void reset_nodraw();
void read(int* idx_list, int idx_cnt);
void set_filter(bool success, bool info, bool warning, bool error, bool fatal,
bool text, char* str);
bool text, const char* str);
void get_filter(bool* success, bool* info, bool* warning, bool* error,
bool* fatal, bool* text);
void draw();
......
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